-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
vant-weapp 组件属性默认值丢失 #11575
Comments
@Chen-jj 这个 issue 被遗忘了 |
应该提供一个配置,让开发者可以自行补全第三方组件的属性与默认值。 |
https://github.com/HyperLife1119/taro-plugin-vant-weapp 最后还是编写了一个插件来解决此问题。 |
Taro v3.4.10 + 已补充文档与用法:https://github.com/NervJS/taro-plugin-inject/tree/v1.0.2#6-thirdpartycomponents |
还有的就是文档中的这个说法并不正确:
https://taro-docs.jd.com/taro/docs/vant#%E4%BD%BF%E7%94%A8-vant-%E7%BB%84%E4%BB%B6 在此之前,只有遇到这个 issue 描述的情况下,默认值会被置为 undefined,需要显示设置(而不只是默认值为 true 才需要显示设置)。 现在文档应该更新为:推荐使用 @tarojs/plugin-inject 自行补全第三方组件默认值。 |
那句是面向另一个问题,即 Vue 属性值
|
难道所有组件都需要自己添加默认属性吗 |
是的。对于 vant-weapp,我编写了一个插件:https://github.com/HyperLife1119/taro-plugin-vant-weapp |
相关平台
微信小程序
复现仓库
https://github.com/HyperLife1119/taro-issue
小程序基础库: 2.23.2
使用框架: Vue 3
复现步骤
van-empty
组件的image
属性默认值为 'default',如果不填的话,默认值是生效的,例如:但在这种情况下,属性默认值丢失了:
因为这时候
van-empty
组件的 image 属性被收集了,但第二个的van-empty
组件并没有设置该属性,导致生成模板的时候给 image 属性赋了个空值(undefined)。期望结果
组件属性默认值不会丢失
实际结果
组件属性默认值在特定情况下丢失了
环境信息
The text was updated successfully, but these errors were encountered: