Skip to content
On this page

选择器

基础用法

代码示例
js
<template>
    <pied-select v-model="inputValue" data="data"></pied-select>
</template>

<script setup>
import { ref } from 'vue'
const inputValue = ref('')
const data = ref([
    {
        value: 1,
        label: 'option1'
    },
    {
        value: 2,
        label: 'option2'
    },
    {
        value: 3,
        label: 'option3'
    },
    {
        value: 4,
        label: 'option4'
    },
    {
        value: 5,
        label: 'option5'
    },
    {
        value: 6,
        label: 'option6'
    },
    {
        value: 7,
        label: 'option7'
    },
    {
        value: 8,
        label: 'option8'
    }
])
</script>

模糊查询

代码示例
js
<template>
    <pied-select v-model="inputValue" filterable data="data"></pied-select>
</template>

<script setup>
import { ref } from 'vue'
const inputValue = ref('')
const data = ref([
    {
        value: 1,
        label: 'option1'
    },
    {
        value: 2,
        label: 'option2'
    },
    {
        value: 3,
        label: 'option3'
    },
    {
        value: 4,
        label: 'option4'
    },
    {
        value: 5,
        label: 'option5'
    },
    {
        value: 6,
        label: 'option6'
    },
    {
        value: 7,
        label: 'option7'
    },
    {
        value: 8,
        label: 'option8'
    }
])
</script>

自定义内容

代码示例
js
<template>
    <pied-select v-model="inputValue" filterable data="data">
        <template v-slot="scope">
            <div class="flex"><p>{{scope.data.value}}</p><p>{{scope.data.label}}</p></div>
        </template>
    </pied-select>
</template>

<script setup>
import { ref } from 'vue'
const inputValue = ref('')
const data = ref([
    {
        value: 1,
        label: 'option1'
    },
    {
        value: 2,
        label: 'option2'
    },
    {
        value: 3,
        label: 'option3'
    },
    {
        value: 4,
        label: 'option4'
    },
    {
        value: 5,
        label: 'option5'
    },
    {
        value: 6,
        label: 'option6'
    },
    {
        value: 7,
        label: 'option7'
    },
    {
        value: 8,
        label: 'option8'
    }
])
</script>

<style>
.flex{
  display: flex;
  justify-content: space-around;
  align-items: center;
}
</style>
参数说明可选值默认值类型
v-model绑定值----------String
type输入类型----------text,password
disabled禁用false,truefalseBoolean
label名称----------String
center居中展示----------Boolean

Released under the MIT License.