全局添加输入框空格校验

This commit is contained in:
GGJ
2024-12-25 10:53:07 +08:00
parent 90efcc4ad2
commit aed771578a
98 changed files with 703 additions and 904 deletions

View File

@@ -6,10 +6,10 @@
</el-row>
<el-row class="ba-array-item" v-for="(item, idx) in state.value" :gutter="10" :key="idx">
<el-col :span="10">
<el-input maxlength="32" show-word-limit v-model="item.key"></el-input>
<el-input maxlength="32" show-word-limit v-model.trim="item.key"></el-input>
</el-col>
<el-col :span="10">
<el-input maxlength="32" show-word-limit v-model="item.value"></el-input>
<el-input maxlength="32" show-word-limit v-model.trim="item.value"></el-input>
</el-col>
<el-col :span="4">
<el-button @click="onDelArrayItem(idx)" size="small" icon="el-icon-Delete" circle />

View File

@@ -37,7 +37,7 @@
</transition>
</div>
<template #reference>
<el-input maxlength="32" show-word-limit v-model='state.inputValue' :size='size' :disabled='disabled'
<el-input maxlength="32" show-word-limit v-model.trim='state.inputValue' :size='size' :disabled='disabled'
placeholder='搜索图标' ref='selectorInput' @focus='onInputFocus' @blur='onInputBlur'
:class="'size-' + size">
<template #prepend>

View File

@@ -2,57 +2,28 @@
<div class="w100">
<!-- el-select 的远程下拉只在有搜索词时才会加载数据显示出 option 列表 -->
<!-- 使用 el-popover 在无数据/无搜索词时显示一个无数据的提醒 -->
<el-popover
width="100%"
placement="bottom"
popper-class="remote-select-popper"
<el-popover width="100%" placement="bottom" popper-class="remote-select-popper"
:visible="state.focusStatus && !state.loading && !state.keyword && !state.options.length"
:teleported="false"
:content="$t('utils.No data')"
>
:teleported="false" :content="$t('utils.No data')">
<template #reference>
<el-select
ref="selectRef"
class="w100"
@focus="onFocus"
@blur="onBlur"
:loading="state.loading || state.accidentBlur"
:filterable="true"
:remote="true"
clearable
remote-show-suffix
:remote-method="onLogKeyword"
v-model="state.value"
@change="onChangeSelect"
:multiple="multiple"
:key="state.selectKey"
@clear="onClear"
@visible-change="onVisibleChange"
v-bind="$attrs"
>
<el-option
class="remote-select-option"
v-for="item in state.options"
:label="item[field]"
:value="item[state.primaryKey].toString()"
:key="item[state.primaryKey]"
>
<el-select ref="selectRef" class="w100" @focus="onFocus" @blur="onBlur"
:loading="state.loading || state.accidentBlur" :filterable="true" :remote="true" clearable
remote-show-suffix :remote-method="onLogKeyword" v-model.trim="state.value" @change="onChangeSelect"
:multiple="multiple" :key="state.selectKey" @clear="onClear" @visible-change="onVisibleChange"
v-bind="$attrs">
<el-option class="remote-select-option" v-for="item in state.options" :label="item[field]"
:value="item[state.primaryKey].toString()" :key="item[state.primaryKey]">
<el-tooltip placement="right" effect="light" v-if="!isEmpty(tooltipParams)">
<template #content>
<p v-for="(tooltipParam, key) in tooltipParams" :key="key">{{ key }}: {{ item[tooltipParam] }}</p>
<p v-for="(tooltipParam, key) in tooltipParams" :key="key">{{ key }}: {{
item[tooltipParam] }}</p>
</template>
<div>{{ item[field] }}</div>
</el-tooltip>
</el-option>
<el-pagination
v-if="state.total"
:currentPage="state.currentPage"
:page-size="state.pageSize"
class="select-pagination"
layout="->, prev, next"
:total="state.total"
@current-change="onSelectCurrentPageChange"
/>
<el-pagination v-if="state.total" :currentPage="state.currentPage" :page-size="state.pageSize"
class="select-pagination" layout="->, prev, next" :total="state.total"
@current-change="onSelectCurrentPageChange" />
</el-select>
</template>
</el-popover>
@@ -304,6 +275,7 @@ defineExpose({
:deep(.remote-select-popper) {
text-align: center;
}
.remote-select-option {
white-space: pre;
}