提交 0ae02ee9 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(page-meta): scroll-top 支持 H5 及 App端

上级 ed24ca37
......@@ -53,10 +53,10 @@ export default {
pageStyle: {
type: String,
default: ''
},
enablePullDownRefresh: {
type: [Boolean, String],
default: false
},
enablePullDownRefresh: {
type: [Boolean, String],
default: false
},
rootFontSize: {
type: String,
......@@ -81,8 +81,8 @@ export default {
// 父节点一定是 page
this.$pageVm.$on('hook:onPageScroll', evt => {
this.$emit('scroll', evt)
})
})
// #ifdef APP-PLUS
this._currentWebview = page.$getAppWebview()
if (this.enablePullDownRefresh) {
......@@ -90,7 +90,7 @@ export default {
}
this.$watch('enablePullDownRefresh', (val) => {
this.setPullDownRefresh(this._currentWebview, val)
})
})
// #endif
// props
......@@ -124,16 +124,18 @@ export default {
this.setPageMeta()
}
this.backgroundTextStyle && this.setBackgroundTextStyle()
},
mounted () {
this.scrollTop && this.pageScrollTo()
},
methods: {
setPullDownRefresh (webview, enabled) {
webview.setStyle({
pullToRefresh: {
support: enabled,
style: plus.os.name === 'Android' ? 'circle' : 'default'
}
})
methods: {
setPullDownRefresh (webview, enabled) {
webview.setStyle({
pullToRefresh: {
support: enabled,
style: plus.os.name === 'Android' ? 'circle' : 'default'
}
})
},
setPageMeta () {
// h5 和 app-plus 设置 rootFontSize
......@@ -187,4 +189,4 @@ export default {
}
}
}
</script>
</script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册