1.主要使用uniapp scroll-view 组件的scroll-into-view属性实现功能
2.代码如下文章来源地址https://www.toymoban.com/news/detail-671318.html
<scroll-view
:scroll-into-view="intoView"
>
<u-tabs
class="tabs-list"
@change="tabChange"
:list="tabList"
>
</u-tabs>
<view id="1"></view>
<view id="2"></view>
<view id="3"></view>
<view id="4"></view>
</scroll-view>
tabList: [
{
name: "1",
id: "1",
},
{
name: "2",
id: "2",
},
{
name: "3",
id: "3",
},
{
name: "4",
id: "5",
},
],
intoView: "",
tabChange(e) {
this.intoView = e.id;
},
文章来源:https://www.toymoban.com/news/detail-671318.html
到了这里,关于uniapp 实现切换tab锚点定位到指定位置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!