uview-plus组件库全面升级更新,订单结算判断支付方式是否可用代码调整,公众号关注二维码修改
This commit is contained in:
@@ -15,6 +15,7 @@ export default {
|
||||
indexList: [],
|
||||
sticky: true,
|
||||
customNavHeight: 0,
|
||||
safeBottomFix: false
|
||||
safeBottomFix: false,
|
||||
itemMargin: '0rpx'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,10 @@ export const props = defineMixin({
|
||||
type: Boolean,
|
||||
default: () => defProps.indexList.safeBottomFix
|
||||
},
|
||||
//自定义下边距
|
||||
itemMargin: {
|
||||
type: String,
|
||||
default: () => defProps.indexList.itemMargin
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<text
|
||||
class="u-index-list__letter__item__index"
|
||||
:style="{color: activeIndex === index ? '#fff' : inactiveColor}"
|
||||
>{{ item }}</text>
|
||||
>{{ item.key || item }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<u-transition
|
||||
@@ -87,7 +87,7 @@
|
||||
width: addUnit(indicatorHeight)
|
||||
}"
|
||||
>
|
||||
<text class="u-index-list__indicator__text">{{ uIndexList[activeIndex] }}</text>
|
||||
<text class="u-index-list__indicator__text">{{ uIndexList[activeIndex]?.key || uIndexList[activeIndex] }}</text>
|
||||
</view>
|
||||
</u-transition>
|
||||
</view>
|
||||
@@ -284,8 +284,10 @@
|
||||
return new Promise(resolve => {
|
||||
// 延时一定时间,以获取dom尺寸
|
||||
// #ifndef APP-NVUE
|
||||
this.$uGetRect('.u-index-list__scroll-view').then(size => {
|
||||
resolve(size)
|
||||
this.$nextTick(() => {
|
||||
this.$uGetRect('.u-index-list__scroll-view').then(size => {
|
||||
resolve(size)
|
||||
})
|
||||
})
|
||||
// #endif
|
||||
|
||||
@@ -389,9 +391,14 @@
|
||||
// 如果偏移量太小,前后得出的会是同一个索引字母,为了防抖,进行返回
|
||||
if (currentIndex === this.activeIndex) return
|
||||
this.activeIndex = currentIndex
|
||||
this.$emit('select', this.uIndexList[currentIndex])
|
||||
// #ifndef APP-NVUE || MP-WEIXIN
|
||||
// 在非nvue中,由于anchor和item都在u-index-item中,所以需要对index-item进行偏移
|
||||
this.scrollIntoView = `u-index-item-${this.uIndexList[currentIndex].charCodeAt(0)}`
|
||||
if (typeof this.uIndexList[currentIndex] == 'string') {
|
||||
this.scrollIntoView = `u-index-item-${this.uIndexList[currentIndex].charCodeAt(0)}`
|
||||
} else {
|
||||
this.scrollIntoView = `u-index-item-${this.uIndexList[currentIndex].name.charCodeAt(0)}`
|
||||
}
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
@@ -406,12 +413,13 @@
|
||||
const anchors = this.anchors
|
||||
// 由于list组件无法获取cell的top值,这里通过header slot和各个item之间的height,模拟出类似非nvue下的位置信息
|
||||
let children = this.children.map((item, index) => {
|
||||
const childHeight = item.height + getPx(this.itemMargin)
|
||||
const child = {
|
||||
height: item.height,
|
||||
height: childHeight,
|
||||
top: top
|
||||
}
|
||||
// 进行累加,给下一个item提供计算依据
|
||||
top = top + item.height
|
||||
top = top + childHeight
|
||||
// #ifdef APP-NVUE
|
||||
// 只有nvue下,需要将锚点的高度也累加,非nvue下锚点高度是包含在index-item中的。
|
||||
top = top + anchors[index].height
|
||||
@@ -419,7 +427,7 @@
|
||||
return child
|
||||
})
|
||||
// console.log('this.children[currentIndex].top', children[currentIndex].top)
|
||||
if (children[currentIndex]?.top) {
|
||||
if (children[currentIndex]?.top || children[currentIndex].top === 0) {
|
||||
this.scrollTop = children[currentIndex].top - getPx(customNavHeight)
|
||||
}
|
||||
// #endif
|
||||
@@ -489,12 +497,13 @@
|
||||
const anchors = this.anchors
|
||||
// 由于list组件无法获取cell的top值,这里通过header slot和各个item之间的height,模拟出类似非nvue下的位置信息
|
||||
children = this.children.map((item, index) => {
|
||||
const childHeight = item.height + getPx(this.itemMargin)
|
||||
const child = {
|
||||
height: item.height,
|
||||
height: childHeight,
|
||||
top: top
|
||||
}
|
||||
// 进行累加,给下一个item提供计算依据
|
||||
top = top + item.height
|
||||
top = top + childHeight
|
||||
// #ifdef APP-NVUE
|
||||
// 只有nvue下,需要将锚点的高度也累加,非nvue下锚点高度是包含在index-item中的。
|
||||
top = top + anchors[index].height
|
||||
@@ -531,7 +540,6 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "../../libs/css/components.scss";
|
||||
|
||||
.u-index-list {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user