[新增] select组件新增search事件,用于触发远程搜索或自定义搜索逻辑
This commit is contained in:
parent
49f5997934
commit
1cdfa5d112
@ -100,6 +100,37 @@ export default {
|
||||
|
||||
:::
|
||||
|
||||
::: title 关键词变化事件,可作为远程搜索处理算法
|
||||
:::
|
||||
|
||||
::: demo
|
||||
|
||||
<template>
|
||||
<lay-select @search="search" v-model="selected">
|
||||
<lay-select-option value="1" label="学习"></lay-select-option>
|
||||
<lay-select-option value="2" label="编码" disabled></lay-select-option>
|
||||
<lay-select-option value="3" label="运动"></lay-select-option>
|
||||
</lay-select>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const selected = ref('1');
|
||||
function search(txt){
|
||||
console.log('关键词:',txt)
|
||||
}
|
||||
return {
|
||||
selected,search
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
:::
|
||||
|
||||
::: title 海量数据
|
||||
:::
|
||||
|
||||
|
@ -56,7 +56,7 @@ const open = function () {
|
||||
openState.value = !openState.value;
|
||||
};
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "change"]);
|
||||
const emit = defineEmits(["update:modelValue", "change", 'search']);
|
||||
const selectItem = ref<SelectItem>({
|
||||
value: !props.multiple
|
||||
? props.modelValue
|
||||
@ -101,6 +101,7 @@ const input = ref(false)
|
||||
const value = computed({
|
||||
set(v: any) {
|
||||
txt.value = v;
|
||||
emit('search', v)
|
||||
},
|
||||
get() {
|
||||
if (input.value) {
|
||||
|
Loading…
Reference in New Issue
Block a user