Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] cascader组件的value属性在重置为""空字符串时,组件显示异常 #5759

Open
zzxqd opened this issue Apr 9, 2024 · 3 comments

Comments

@zzxqd
Copy link
Contributor

zzxqd commented Apr 9, 2024

重现链接

https://developers.weixin.qq.com/s/IIQT4jm77rQm

Vant Weapp 版本

1.11.4

描述一下你遇到的问题。

重置value后cascader不展示任何选项。

重现步骤

随便一个多层级的options,选择一个最末一级到节点,之后将value重新赋值为""数值

设备/浏览器

No response

@zzxqd
Copy link
Contributor Author

zzxqd commented Apr 9, 2024

看了下源码,在watch value -> this.updateValue -> this.updateTabs 中没有重置activeTab导致的,需要的话我可以发个pr

@nikolausliu
Copy link

看了下源码,在watch value -> this.updateValue -> this.updateTabs 中没有重置activeTab导致的,需要的话我可以发个pr

看了下这个pr的改动还没有发版,我也遇到了这个bug,说下我的处理方式,其它开发者遇到这个问题如果不升版本可以这样修复这个bug:

<van-cascader value="{{value}}" id="cascader" />
// 重置value后,选中cascader组件,设置activeTab为0
this.selectComponent('#cascader').setData({
  activeTab: 0,
})

@zzxqd
Copy link
Contributor Author

zzxqd commented May 13, 2024

看了下源码,在watch value -> this.updateValue -> this.updateTabs 中没有重置activeTab导致的,需要的话我可以发个pr

看了下这个pr的改动还没有发版,我也遇到了这个bug,说下我的处理方式,其它开发者遇到这个问题如果不升版本可以这样修复这个bug:

<van-cascader value="{{value}}" id="cascader" />
// 重置value后,选中cascader组件,设置activeTab为0
this.selectComponent('#cascader').setData({
  activeTab: 0,
})

如果只有一个人在维护项目,直接改生成的小程序npm包中的源码也可以

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants