youzan / vant-weapp

轻量、可靠的小程序 UI 组件库
https://vant.pro/vant-weapp/
MIT License
17.68k stars 3.48k forks source link

[Bug Report] tab标签组件在使用动态数据时,第一个选中状态的下标线会偏移到最左侧 #5135

Closed jirentech closed 1 year ago

jirentech commented 1 year ago

重现链接

<van-tabs swipeable sticky :active="active" @change="onChange">

链接

Vant Weapp 版本

v1.10.7

描述一下你遇到的问题。

[tab标签组件在使用动态数据的时候,默认的active,即第一个选择状态的下标线会偏移到最左侧]

微信截图_20221209153054

重现步骤

tab标签组件在使用动态数据(动态数据通过网络请求获得)的时候,即第一个选中状态的下标线会偏移到最左侧

设备/浏览器

微信开发者工具,安卓手机

landluck commented 1 year ago

动态数据?怎么样使用动态数据,可以参考 https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html 提供代码片段协助定位问题

jirentech commented 1 year ago

动态数据?怎么样使用动态数据,可以参考 https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html 提供代码片段协助定位问题

动态数据就是使用网络请求获取到的数据

landluck commented 1 year ago

提供一个小程序代码片段吧,网络请求可以用 setTimeout 模拟

forget1 commented 1 year ago

this.selectComponent('#xxx').resize()应该是可以暂时解决掉这个问题,之前用过这个方式

jirentech commented 1 year ago

@landluck 小程序代码片段 https://developers.weixin.qq.com/s/eVv6XEmw7QFD

landluck commented 1 year ago

问题已定位到,this.selectComponent('#xxx').resize() 可以临时解决,后续会修复

landluck commented 1 year ago

@johnsonwong666

landluck commented 1 year ago

v1.10.19 版本已修复