组件优化

This commit is contained in:
bb_pan 2025-06-24 09:32:54 +08:00
parent a7573998d1
commit 220bb5a3c6
2 changed files with 13 additions and 7 deletions

View File

@ -98,6 +98,7 @@
//
openOptions() {
if (this.disabled) return
if(this.showLabel==""){
this.selectData=this.options
}else{
@ -121,16 +122,15 @@
},
//
inputChange(e){
console.log(e)
// console.log(e)
if(e==""){
this.selectData=this.options
}else{
this.selectData=this.mapTree(e,this.options)
}
console.log(this.selectData)
// console.log(this.selectData)
},
mapTree(value,arr){
console.log("sssssss")
let newarr = [];
arr.forEach(element => {
if (element.name.indexOf(value) > -1) { //
@ -141,7 +141,8 @@
if (redata && redata.length > 0) {
let obj = {
...element,
children: redata
children: redata,
expanded: true //
};
newarr.push(obj);
}
@ -207,7 +208,7 @@
/* 下拉容器样式 外层 */
.ep-picker-content-wrap {
max-height: 30vh;
max-height: 48vh;
width: 100%;
position: absolute;
top: 88rpx;
@ -223,7 +224,7 @@
padding: 3px 0;
box-shadow: 0 0 20rpx 5rpx rgb(0 0 0 / 30%);
border-radius: 5px;
max-height: 181px;
max-height: 46vh;
}
/* 下拉项通用样式 */

View File

@ -30,7 +30,12 @@
inject: ['defaultProps', 'onClickItem'],
data() {
return {
show: false
show: !!this.item.expanded
}
},
watch: {
'item.expanded'(val) {
this.show = !!val;
}
},
methods: {