mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-14 09:20:51 +08:00
1854891bce
* docs: [el-select] add demo of how to use value-key * docs: [selectV2] add demo of how to use value-key * Update use-valueKey.vue Co-authored-by: RealityBoy <1923740402@qq.com>
29 lines
566 B
Vue
29 lines
566 B
Vue
<template>
|
|
<el-select-v2
|
|
v-model="value"
|
|
:options="options"
|
|
placeholder="Please select"
|
|
value-key="value.name"
|
|
/>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue'
|
|
const initials = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
|
|
|
|
const value = ref('')
|
|
const options = Array.from({ length: 1000 }).map((_, idx) => ({
|
|
value: {
|
|
name: `Option ${idx + 1}`,
|
|
test: `test ${idx % 3}`,
|
|
},
|
|
label: `${initials[idx % 10]}${idx}`,
|
|
}))
|
|
</script>
|
|
|
|
<style scoped>
|
|
.example-showcase .el-select-v2 {
|
|
margin-right: 20px;
|
|
}
|
|
</style>
|