tiny-vue/examples/sites/demos/pc/app/base-select/optimization-composition-ap...

47 lines
982 B
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<p>单选</p>
<tiny-base-select v-model="value1" :options="options" optimization @change="onChange"></tiny-base-select>
<p>多选</p>
<tiny-base-select
v-model="value2"
optimization
multiple
collapse-tags
:multiple-limit="5"
:options="options"
@change="onChange"
></tiny-base-select>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { BaseSelect as TinyBaseSelect, Modal } from '@opentiny/vue'
const buildOptions = () =>
Array.from({ length: 100000 }).map((item, i) => JSON.parse(`{"value":"选项${i}","label":"北京${i}"}`))
const value1 = ref('')
const value2 = ref([])
const options = ref(buildOptions())
const onChange = (value) => {
Modal.message({
message: JSON.stringify(value),
status: 'info'
})
}
</script>
<style lang="less" scoped>
.tiny-base-select {
width: 280px;
}
p {
font-size: 14px;
line-height: 1.5;
padding: 16px 0;
}
</style>