uview-plus组件库全面升级更新,订单结算判断支付方式是否可用代码调整,公众号关注二维码修改
This commit is contained in:
@@ -8,24 +8,24 @@
|
||||
<view class="u-dropdown__menu__item" v-for="(item, index) in menuList" :key="index" @tap.stop="menuClick(index)">
|
||||
<view class="u-flex u-flex-row">
|
||||
<text class="u-dropdown__menu__item__text" :style="{
|
||||
color: item.disabled ? '#c0c4cc' : (index === current || highlightIndex == index) ? activeColor : inactiveColor,
|
||||
color: item.disabled ? '#c0c4cc' : (index === current || highlightIndexList.includes(index)) ? activeColor : inactiveColor,
|
||||
fontSize: addUnit(titleSize)
|
||||
}">{{item.title}}</text>
|
||||
<view class="u-dropdown__menu__item__arrow" :class="{
|
||||
'u-dropdown__menu__item__arrow--rotate': index === current
|
||||
}">
|
||||
<u-icon :custom-style="{display: 'flex'}" :name="menuIcon" :size="addUnit(menuIconSize)" :color="index === current || highlightIndex == index ? activeColor : '#c0c4cc'"></u-icon>
|
||||
<up-icon :custom-style="{display: 'flex'}" :name="menuIcon" :size="addUnit(menuIconSize)" :color="index === current || highlightIndexList.includes(index) ? activeColor : '#c0c4cc'"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-dropdown__content" :style="[contentStyle, {
|
||||
transition: `opacity ${duration / 1000}s linear`,
|
||||
top: addUnit(height),
|
||||
height: contentHeight + 'px'
|
||||
transition: `opacity ${duration / 1000}s, z-index ${duration / 1000}s linear`,
|
||||
top: addUnit(height)
|
||||
}]"
|
||||
@tap="maskClick" @touchmove.stop.prevent>
|
||||
<view @tap.stop.prevent class="u-dropdown__content__popup" :style="[popupStyle]">
|
||||
<view @tap.stop.prevent class="u-dropdown__content__popup" :style="[popupStyle, {
|
||||
}]">
|
||||
<slot></slot>
|
||||
</view>
|
||||
<view class="u-dropdown__content__mask"></view>
|
||||
@@ -71,8 +71,8 @@
|
||||
zIndex: -1,
|
||||
opacity: 0
|
||||
},
|
||||
// 让某个菜单保持高亮的状态
|
||||
highlightIndex: 99999,
|
||||
// 让某些菜单保持高亮的状态
|
||||
highlightIndexList: [],
|
||||
contentHeight: 0
|
||||
}
|
||||
},
|
||||
@@ -129,6 +129,7 @@
|
||||
// 展开时,设置下拉内容的样式
|
||||
this.contentStyle = {
|
||||
zIndex: 11,
|
||||
height: this.contentHeight + 'px'
|
||||
}
|
||||
// 标记展开状态以及当前展开项的索引
|
||||
this.active = true;
|
||||
@@ -147,10 +148,11 @@
|
||||
this.active = false;
|
||||
this.current = 99999;
|
||||
// 下拉内容的样式进行调整,不透明度设置为0
|
||||
this.contentStyle = {
|
||||
zIndex: -1,
|
||||
opacity: 0
|
||||
}
|
||||
this.contentStyle.zIndex = -1;
|
||||
this.contentStyle.opacity = 0;
|
||||
setTimeout(() => {
|
||||
this.contentStyle.height = 0;
|
||||
}, this.duration)
|
||||
},
|
||||
// 点击遮罩
|
||||
maskClick() {
|
||||
@@ -158,9 +160,13 @@
|
||||
if (!this.closeOnClickMask) return;
|
||||
this.close();
|
||||
},
|
||||
// 外部手动设置某个菜单高亮
|
||||
highlight(index = undefined) {
|
||||
this.highlightIndex = index !== undefined ? index : 99999;
|
||||
// 外部手动设置某些菜单高亮
|
||||
highlight(indexParams = undefined) {
|
||||
if (Array.isArray(indexParams)) {
|
||||
this.highlightIndexList = [...indexParams];
|
||||
return;
|
||||
}
|
||||
this.highlightIndexList = indexParams !== undefined ? [indexParams] : [];
|
||||
},
|
||||
// 获取下拉菜单内容的高度
|
||||
getContentHeight() {
|
||||
@@ -181,7 +187,6 @@
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "../../libs/css/components.scss";
|
||||
|
||||
.u-dropdown {
|
||||
flex: 1;
|
||||
|
||||
Reference in New Issue
Block a user