scroll-into-view scroll-into-view问题?

发布于 7 年前作者 flu13699 次浏览最后编辑 7 年前来自 issues

<scroll-view scroll-x scroll-into-view=‘{{toView}}’>

<view class=“test” id=“item{{index}}” wx:for=“{{categories}}” wx:key=‘index’>

<view class=“inner”>{{index}}</view>

</view>

</scroll-view>

categories是我接口数据,当我使用接口数据时scroll-into-view就无效,好迷啊,当我做一个demo写wx:for="{{20}}"时scroll-into-view是有效的

请求帮忙解决,如有大神请评论联系留下联系方式,感谢

1 回复
xiuying92
xiuying921 楼5 年前

你这当然迷咯,onLoad事件肯定优先于网络请求执行

this.setData({

    toView: options.view

})

应该在网络请求完成后设置