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

* feat(components): [select-v2] add `width` prop * feat(components): [select-v2] change `width` prop to `fit-input-width` * docs(components): add description * test(components): [select-v2] fix errors caused by canvas * chore(components): optimize code and change documents Co-authored-by: thinkasany <480968828@qq.com> Co-authored-by: btea <2356281422@qq.com> * feat: [select-v2] listen for `fit-input-width` * fix: change the default value of the `fit-input-width` prop * fix: the width did not change when remote search or creating temporary option * docs: change document and example code --------- Co-authored-by: thinkasany <480968828@qq.com> Co-authored-by: btea <2356281422@qq.com>
44 lines
1014 B
Vue
44 lines
1014 B
Vue
<template>
|
|
<div class="flex flex-wrap gap-4 items-center">
|
|
<el-select-v2
|
|
v-model="value"
|
|
:options="options"
|
|
placeholder="Please select"
|
|
style="width: 240px"
|
|
:fit-input-width="false"
|
|
/>
|
|
|
|
<el-select-v2
|
|
v-model="value"
|
|
:options="options"
|
|
placeholder="Please select"
|
|
style="width: 240px"
|
|
fit-input-width
|
|
/>
|
|
|
|
<el-select-v2
|
|
v-model="value"
|
|
:options="options"
|
|
placeholder="Please select"
|
|
style="width: 240px"
|
|
:fit-input-width="440"
|
|
>
|
|
<template #default="{ item }">
|
|
<span>{{ item.value + item.label }}</span>
|
|
</template>
|
|
</el-select-v2>
|
|
</div>
|
|
</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: `Option ${idx + 1}`,
|
|
label: `${initials[idx % 10]}${idx}${'-'.repeat(Math.ceil(idx / 25))}`,
|
|
}))
|
|
</script>
|