This commit is contained in:
王一嘉
2025-07-21 08:54:13 +08:00
parent 50a85dd274
commit b15962dd65
4 changed files with 37 additions and 13 deletions

View File

@@ -2,6 +2,7 @@
import DOWNICON from "../static/icons/down.png";
import {onMounted, reactive} from "vue";
const emits = defineEmits(['change']);
const {placeholder, api} = defineProps({
placeholder: {
type: String,
@@ -19,6 +20,7 @@ const modelValue = defineModel();
const change = ({detail: {value}}) => {
modelValue.value = list.filter(v => !v.hidden)[value].id;
emits('change', modelValue.value);
}
onMounted(() => {
@@ -31,7 +33,7 @@ onMounted(() => {
<template>
<picker :range="list.filter(v => !v.hidden).map(v => v.name)" @change="change">
<view class="x-select">
<view class="x-select" v-if="!$slots.default">
<view v-if="modelValue === null" class="text-[#86909C] test-28r">
{{ placeholder }}
</view>
@@ -41,6 +43,7 @@ onMounted(() => {
<image :src="DOWNICON" class="!size-[24rpx]" mode="aspectFill"></image>
</view>
<slot v-else></slot>
</picker>
</template>