添加102联机记录
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
</view>
|
||||
<view class="menu-items" v-if="config.menuItems && config.menuItems.length>0">
|
||||
<view class="menu-item" v-for="(item, index) in config.menuItems" :key="index" :style="{
|
||||
color: config.textColor,
|
||||
color: config.textColor,
|
||||
textAlign: config.textAlign,
|
||||
height:config.itemHeight,
|
||||
lineHeight:config.itemHeight,
|
||||
@ -23,7 +23,7 @@
|
||||
paddingRight: config.dividerMargin
|
||||
}" @click="handleItemClick(item, index)">
|
||||
|
||||
<view class="p100" :style="{backgroundColor:config.activeIndex==index?config.itemBgColor:'',
|
||||
<view class="p100" :style="{backgroundColor:(config.activeIndex==index || item[config.valueMember]==config.value) ?config.itemBgColor:'',
|
||||
justifyContent:config.textAlign
|
||||
}">
|
||||
<view class="imgContent" v-if="item.icon" :style="{
|
||||
@ -73,6 +73,8 @@
|
||||
maskBgColor: '', //mask的颜色
|
||||
menuItems: [], //菜单项 包含icon text
|
||||
activeIndex: -1, //当前已选中的项编号
|
||||
valueMember:'',
|
||||
value:null,
|
||||
bgColor: '#2a2a2a', //主体背景
|
||||
itemBgColor: '#3a3a3a', //各项被选中后的背景
|
||||
textColor: '#ffffffde', //各项的文字颜色
|
||||
@ -91,7 +93,16 @@
|
||||
|
||||
|
||||
},
|
||||
|
||||
created(){
|
||||
if(this.config.value && this.config.valueMember){
|
||||
this.config.menuItems.find((v,i)=>{
|
||||
if(v[this.config.valueMember]==this.config.value){
|
||||
this.config.activeIndex=i;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
closeMenu() {
|
||||
|
||||
@ -108,6 +119,16 @@
|
||||
let index = null;
|
||||
if (this.config.activeIndex > -1) {
|
||||
item = this.config.menuItems[this.config.activeIndex];
|
||||
}else{
|
||||
for (let i = 0; i < this.config.menuItems.length; i++) {
|
||||
var element = this.config.menuItems[i];
|
||||
if(element[this.config.valueMember]==this.config.value){
|
||||
item=element;
|
||||
index=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
index = this.config.activeIndex;
|
||||
this.$emit('btnClick', item, index);
|
||||
|
||||
Reference in New Issue
Block a user