Dafrok / vue-iscroll-view

IScroll-view component for Vue 2.x
https://dafrok.github.io/vue-iscroll-view
MIT License
148 stars 26 forks source link

vue-iscroll-view 在动态数据渲染下,刷新无效。 #17

Closed brant9527 closed 7 years ago

brant9527 commented 7 years ago
- <template>
-   <iscroll-view class="scroll-view" ref="iscroll" @pullUp="load" @pullDown="refresh">
-       <card v-for="item in cardList" v-bind:item="item" :key="item.id"></card>
-   </iscroll-view>
- </template>

js code

computed: {
            ...mapGetters([
                'cardList'
            ])
        },
mounted() {
            /* Get the reference of the scroller */
            this.$refs.iscroll.refresh()
            (iscroll才有实例,iscrollView 提示undefind)
        }

现象描述:第一次数据请求回来时,渲染结果如图 image 但是不能滑动,怀疑高度为0(之前只用 iscroll 时,数组改动时需要refresh,怀疑是refresh 无效),接着,点击进入别的页面,在正常跳转回这个页面时,页面滚动生效。

Dafrok commented 7 years ago

你要在更新视图的下一个 tick 执行 refresh。

brant9527 commented 7 years ago

谢谢