提交 2c69835a 编写于 作者: shutao-dc's avatar shutao-dc

update sticky-section.nvue 拉齐web端与app渲染差异

上级 4294f937
...@@ -7,6 +7,7 @@ describe('component-native-sticky-section', () => { ...@@ -7,6 +7,7 @@ describe('component-native-sticky-section', () => {
//检测吸顶上推效果 //检测吸顶上推效果
it('check_sticky_section', async () => { it('check_sticky_section', async () => {
page.waitFor(300)
await page.callMethod('listViewScrollByY', 1000) await page.callMethod('listViewScrollByY', 1000)
const image = await program.screenshot({fullPage: true}); const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot(); expect(image).toSaveImageSnapshot();
......
<template> <template>
<page-head title="sticky-section"></page-head> <page-head title="sticky-section"></page-head>
<button style="position: fixed; width: 50px; height: 50px;" @click="listViewScrollByY(1000)">测试</button>
<list-view id="list-view" ref="list-view" show-scrollbar=false class="page" :scroll-into-view="scrollIntoView" <list-view id="list-view" ref="list-view" show-scrollbar=false class="page" :scroll-into-view="scrollIntoView"
@scroll="onScroll" @scrollend="onScrollEnd" rebound="false"> @scroll="onScroll" @scrollend="onScrollEnd" rebound="false">
<!-- #ifdef APP -->
<list-item style="padding: 10px; margin: 5px 0;align-items: center;" :type = 20> <list-item style="padding: 10px; margin: 5px 0;align-items: center;" :type = 20>
<button @click="gotoStickyHeader('C')" size="mini">跳转到id为C的sticky-header位置上</button> <button @click="gotoStickyHeader('C')" size="mini">跳转到id为C的sticky-header位置上</button>
</list-item> </list-item>
<!-- #endif -->
<sticky-section v-for="(sectionText) in data" :padding="sectionPadding" :push-pinned-header="true"> <sticky-section v-for="(sectionText) in data" :padding="sectionPadding" :push-pinned-header="true">
<sticky-header :header-id="sectionText" :id="sectionText"> <sticky-header :header-id="sectionText" :id="sectionText">
<text class="sticky-header-text">{{sectionText}}</text> <text class="sticky-header-text">{{sectionText}}</text>
...@@ -44,7 +43,12 @@ ...@@ -44,7 +43,12 @@
listview.scrollTop = y listview.scrollTop = y
}, },
gotoStickyHeader(id : string) { gotoStickyHeader(id : string) {
// #ifdef APP
this.scrollIntoView = id this.scrollIntoView = id
// #endif
// #ifdef WEB
console.log("web端不支持该功能")
// #endif
}, },
onScroll() { onScroll() {
this.scrolling = true this.scrolling = true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册