[新增] select组件支持传入items属性用于渲染选择项

This commit is contained in:
castleiMac
2022-04-03 17:48:09 +08:00
parent 18ee8db079
commit 8b4d0abd3c
3 changed files with 42 additions and 1 deletions

View File

@@ -157,6 +157,37 @@ export default {
}
</script>
:::
::: title 传入items属性进行选项渲染
:::
::: demo
<template>
<lay-select v-model="selected" :items="items">
</lay-select>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const selected = ref('1');
const items=ref([
{label:'选项1',value:1,keyword:'选项xuanxiang1'},
{label:'选项2',value:2,keyword:'选项xuanxiang2'},
{label:'选项3',value:3,keyword:'选项xuanxiang3'},
])
return {
selected,items
}
}
}
</script>
:::
::: title 海量数据