mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-14 10:00:58 +08:00

* feat(components): add empty values * feat(hooks): update * feat(components): update * feat(components): update * feat: update * feat(components): update * feat(components): update * feat(components): update * feat: update doc * feat: add doc
36 lines
712 B
Vue
36 lines
712 B
Vue
<template>
|
|
<el-select-v2
|
|
v-model="value"
|
|
:options="options"
|
|
:empty-values="[null, undefined]"
|
|
:value-on-clear="null"
|
|
clearable
|
|
placeholder="Select"
|
|
style="width: 240px"
|
|
@clear="handleClear"
|
|
/>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { ref } from 'vue'
|
|
import { ElMessage } from 'element-plus'
|
|
|
|
const value = ref('')
|
|
|
|
const initials = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
|
|
|
|
const options = Array.from({ length: 1000 }).map((_, idx) => ({
|
|
value: `Option ${idx + 1}`,
|
|
label: `${initials[idx % 10]}${idx}`,
|
|
}))
|
|
|
|
options.unshift({
|
|
value: '',
|
|
label: 'All',
|
|
})
|
|
|
|
const handleClear = () => {
|
|
ElMessage.info(`The clear value is: ${value.value}`)
|
|
}
|
|
</script>
|