export default { data() { return { scrollTop: 0, oldScrollTop: 0 } }, methods: { upper: function (e : ScrollToUpperEvent) { console.log(e) }, lower: function (e : ScrollToLowerEvent) { console.log(e) }, scroll: function (e : ScrollEvent) { this.oldScrollTop = e.detail.scrollTop }, goTop: function () { // 解决view层不同步的问题 this.scrollTop = this.oldScrollTop this.$nextTick(function () { this.scrollTop = 0 }); uni.showToast({ icon: "none", title: "纵向滚动 scrollTop 值已被修改为 0" }) } } } const GenPagesComponentScrollViewScrollViewStyles = [new Map>>([["common-page-head", new Map([["", new Map([["paddingTop", "35rpx"], ["paddingRight", "35rpx"], ["paddingBottom", "35rpx"], ["paddingLeft", "35rpx"], ["flexDirection", "row"], ["justifyContent", "center"]])]])], ["common-page-head-title-box", new Map([["", new Map([["paddingTop", 0], ["paddingRight", "40rpx"], ["paddingBottom", 0], ["paddingLeft", "40rpx"], ["height", "88rpx"], ["borderBottomWidth", "2rpx"], ["borderBottomStyle", "solid"], ["borderBottomColor", "#D8D8D8"]])]])], ["common-page-head-title", new Map([["", new Map([["lineHeight", "88rpx"], ["fontSize", "30rpx"], ["color", "#BEBEBE"]])]])], ["scroll-Y", new Map([["", new Map([["height", "300rpx"]])]])], ["scroll-view_H", new Map([["", new Map([["width", "100%"], ["flexDirection", "row"]])]])], ["scroll-view-item", new Map([["", new Map([["height", "300rpx"], ["justifyContent", "center"], ["alignItems", "center"]])]])], ["scroll-view-item_H", new Map([["", new Map([["width", "690rpx"], ["height", "300rpx"], ["justifyContent", "center"], ["alignItems", "center"]])]])], ["text", new Map([["", new Map([["fontSize", "36rpx"], ["color", "#ffffff"]])]])]])] @Suppress("UNUSED_PARAMETER") function GenPagesComponentScrollViewScrollViewRender(_ctx: GenPagesComponentScrollViewScrollView): VNode | null { const _component_page_head = resolveComponent("page-head") return createElementVNode("view", null, [ createVNode(_component_page_head, new Map([["title", "scroll-view,区域滚动视图"]])), createElementVNode("view", new Map([["class", "uni-padding-wrap uni-common-mt"]]), [ createElementVNode("view", new Map([["class", "uni-title uni-common-mt"]]), [ createElementVNode("text", new Map([["class", "uni-title-text"]]), "Vertical Scroll"), createElementVNode("text", new Map([["class", "uni-subtitle-text"]]), "纵向滚动") ]), createElementVNode("view", null, [ createElementVNode("scroll-view", new Map([ ["scrollTop", _ctx.scrollTop], ["scrollY", true], ["class", "scroll-Y"], ["onScrolltoupper", _ctx.upper], ["onScrolltolower", _ctx.lower], ["onScroll", _ctx.scroll] ]), [ createElementVNode("view", new Map([ ["id", "demo1"], ["class", "scroll-view-item uni-bg-red"] ]), [ createElementVNode("text", new Map([["class", "text"]]), "A") ]), createElementVNode("view", new Map([ ["id", "demo2"], ["class", "scroll-view-item uni-bg-green"] ]), [ createElementVNode("text", new Map([["class", "text"]]), "B") ]), createElementVNode("view", new Map([ ["id", "demo3"], ["class", "scroll-view-item uni-bg-blue"] ]), [ createElementVNode("text", new Map([["class", "text"]]), "C") ]) ], 40 /* PROPS, HYDRATE_EVENTS */, ["scrollTop", "onScrolltoupper", "onScrolltolower", "onScroll"]) ]), createElementVNode("view", new Map([ ["onClick", _ctx.goTop], ["class", "uni-center uni-common-mt"] ]), [ createElementVNode("text", new Map([["class", "uni-link"]]), "点击这里返回顶部") ], 8 /* PROPS */, ["onClick"]), createElementVNode("view", new Map([["class", "uni-title uni-common-mt"]]), [ createElementVNode("text", new Map([["class", "uni-title-text"]]), "Horizontal Scroll"), createElementVNode("text", new Map([["class", "uni-subtitle-text"]]), "横向滚动") ]), createElementVNode("view", null, [ createElementVNode("scroll-view", new Map([ ["class", "scroll-view_H"], ["scrollX", true], ["onScroll", _ctx.scroll], ["scrollLeft", 120] ]), [ createElementVNode("view", new Map([ ["id", "demo1"], ["class", "scroll-view-item_H uni-bg-red"] ]), [ createElementVNode("text", new Map([["class", "text"]]), "A") ]), createElementVNode("view", new Map([ ["id", "demo2"], ["class", "scroll-view-item_H uni-bg-green"] ]), [ createElementVNode("text", new Map([["class", "text"]]), "B") ]), createElementVNode("view", new Map([ ["id", "demo3"], ["class", "scroll-view-item_H uni-bg-blue"] ]), [ createElementVNode("text", new Map([["class", "text"]]), "C") ]) ], 40 /* PROPS, HYDRATE_EVENTS */, ["onScroll"]) ]), createElementVNode("view", new Map([["class", "uni-common-pb"]])) ]) ]) }