This commit is contained in:
2025-08-05 15:25:23 +08:00
parent 0515e9d48c
commit 043f477609
1263 changed files with 202002 additions and 159652 deletions
@@ -1,10 +1,10 @@
<template>
<view class="u-picker-warrper">
<view v-if="hasInput" class="u-picker-input cursor-pointer" @click="onShowByClickInput">
<slot>
<up-input :disabled="disabled" :disabledColor="disabledColor" :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
<div class="input-cover"></div>
</slot>
<view v-if="hasInput" class="u-picker-input cursor-pointer" @click="onShowByClickInput">
<slot>
<up-input :disabled="disabled" :disabledColor="disabledColor" :placeholder="placeholder" :readonly="true" border="surround" v-model="inputLabel"></up-input>
<div class="input-cover"></div>
</slot>
</view>
<u-popup
:show="show || (hasInput && showByClickInput)"
@@ -122,11 +122,11 @@ export default {
immediate: true,
deep:true,
handler(n,o) {
// 修复uniapp调用子组件直接:defaultIndex="[0]"这样写
// v-model的值变化时候导致defaultIndexwatch也会执行的问题
//单纯vue不会出现
if (!o || n.join("/") != o.join("/")) {
this.setIndexs(n, true)
// 修复uniapp调用子组件直接:defaultIndex="[0]"这样写
// v-model的值变化时候导致defaultIndexwatch也会执行的问题
//单纯vue不会出现
if (!o || n.join("/") != o.join("/")) {
this.setIndexs(n, true)
}
}
},
@@ -141,37 +141,37 @@ export default {
},
emits: ['close', 'cancel', 'confirm', 'change', 'update:modelValue', 'update:show'],
computed: {
//已选&&已确认的值显示在input上面的文案
inputLabel() {
let firstItem = this.innerColumns[0] && this.innerColumns[0][0];
// //区分是不是对象数组
if (firstItem && Object.prototype.toString.call(firstItem) === '[object Object]') {
let res = this.innerColumns[0].filter(item => this.modelValue.includes(item['id']))
res = res.map(item => item[this.keyName]);
return res.join("/");
} else {
//用户确定的值,才显示到输入框
return this.modelValue.join("/");
}
},
//已选,待确认的值
inputValue() {
let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
let res = []
//区分是不是对象数组
if (items[0] && Object.prototype.toString.call(items[0]) === '[object Object]') {
//对象数组返回id集合
items.forEach(element => {
res.push(element && element['id'])
});
} else {
//非对象数组返回元素集合
items.forEach((element, index) => {
res.push(element)
});
}
return res
//已选&&已确认的值显示在input上面的文案
inputLabel() {
let firstItem = this.innerColumns[0] && this.innerColumns[0][0];
// //区分是不是对象数组
if (firstItem && Object.prototype.toString.call(firstItem) === '[object Object]') {
let res = this.innerColumns[0].filter(item => this.modelValue.includes(item['id']))
res = res.map(item => item[this.keyName]);
return res.join("/");
} else {
//用户确定的值,才显示到输入框
return this.modelValue.join("/");
}
},
//已选,待确认的值
inputValue() {
let items = this.innerColumns.map((item, index) => item[this.innerIndex[index]])
let res = []
//区分是不是对象数组
if (items[0] && Object.prototype.toString.call(items[0]) === '[object Object]') {
//对象数组返回id集合
items.forEach(element => {
res.push(element && element['id'])
});
} else {
//非对象数组返回元素集合
items.forEach((element, index) => {
res.push(element)
});
}
return res
}
},
methods: {
@@ -346,17 +346,17 @@ export default {
.u-picker {
position: relative;
&-input {
position: relative;
.input-cover {
opacity: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
&-input {
position: relative;
.input-cover {
opacity: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index:1;
}
z-index:1;
}
}
&__view {