|
@@ -8,6 +8,7 @@
|
|
<u-picker
|
|
<u-picker
|
|
:show="show"
|
|
:show="show"
|
|
:columns="[columns]"
|
|
:columns="[columns]"
|
|
|
|
+ :defaultIndex="[defaultIndex]"
|
|
keyName="name"
|
|
keyName="name"
|
|
@cancel="show=false"
|
|
@cancel="show=false"
|
|
@confirm="confirm"
|
|
@confirm="confirm"
|
|
@@ -47,6 +48,12 @@ const dispayText = computed(() => {
|
|
return props.columns.find(item => item.id == props.modelValue)?.name || props.defaultText;
|
|
return props.columns.find(item => item.id == props.modelValue)?.name || props.defaultText;
|
|
return props.defaultText;
|
|
return props.defaultText;
|
|
});
|
|
});
|
|
|
|
+const defaultIndex = computed(() => {
|
|
|
|
+ let index = -1;
|
|
|
|
+ if (props.columns)
|
|
|
|
+ index = props.columns.findIndex(item => item.id == props.modelValue);
|
|
|
|
+ return index >= 0 ? index : 0;
|
|
|
|
+});
|
|
|
|
|
|
function confirm(e: { value: SimpleDropDownPickerItem[] }) {
|
|
function confirm(e: { value: SimpleDropDownPickerItem[] }) {
|
|
show.value = false;
|
|
show.value = false;
|