提交 4bb8a099 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

fix: Element.setAttribute 类型错误问题

上级 c2ba276f
......@@ -35,7 +35,7 @@
uni.$emit('tabchange', e.detail.scrollTop)
},
scrollTop(top : number) {
(this.$refs["listView"] as Element).setAttribute('scrollTop', top)
(this.$refs["listView"] as Element).scrollTop = top
}
}
}
......
......@@ -205,8 +205,10 @@
this.$indicatorNode?.style?.setProperty('transform', `translateX(${x}px) scaleX(${indicator_line_w})`)
// 滚动到水平中心位置
const scroll_x = x - this.$swiperWidth / 2
this.$tabScrollView?.setAttribute('scrollLeft', scroll_x)
const scroll_x = x - this.$swiperWidth / 2
if(this.$tabScrollView !== null){
this.$tabScrollView!.scrollLeft = scroll_x
}
},
initSwiperItemData(index : number) {
if (!this.swiperList[index].preload) {
......
......@@ -201,7 +201,9 @@
// 滚动到水平中心位置
const scroll_x = x - this.$swiperWidth / 2
this.$tabScrollView?.setAttribute('scrollLeft', scroll_x)
if(this.$tabScrollView !== null){
this.$tabScrollView!.scrollLeft = scroll_x
}
},
initSwiperItemData(index : number) {
if (!this.swiperList[index].preload) {
......
......@@ -164,7 +164,9 @@
// 滚动到水平中心位置
const scroll_x = x - this.$swiperWidth / 2
this.$tabScrollView?.setAttribute('scrollLeft', scroll_x)
if(this.$tabScrollView !== null){
this.$tabScrollView!.scrollLeft = scroll_x
}
}
}
}
......
......@@ -122,7 +122,9 @@
// 滚动到水平中心位置
const target_x = lerpNumber(current_node.offsetLeft, move_to_node.offsetLeft, percentage)
const center_x = target_x + move_to_node.offsetWidth / 2 - this.$swiperWidth / 2
this.$tabScrollView?.setAttribute('scrollLeft', center_x)
if(this.$tabScrollView !== null){
this.$tabScrollView!.scrollLeft = center_x
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册