uni-app 传入默认true的Boolean类型错误
uni-app 传入默认true的Boolean类型错误
示例代码:
<van-button text="朴素按钮" :plain="true" type="primary"></van-button>
<van-button text="朴素按钮" plain type="info"></van-button>
操作步骤:
- 父组件传入一个Boolean类型到子组件
预期结果:
- 支持第二种方式
实际结果:
- 第二种报错
bug描述:
子组件中接收了一个plain的Boolean属性,最常用的方式会报错
<van-button text="朴素按钮" :plain="true" type="primary"></van-button>
<van-button text="朴素按钮" plain type="info"></van-button>
第一种合法,第二种最常用的不合法,认为传入的是string类型的空字符

更多关于uni-app 传入默认true的Boolean类型错误的实战教程也可以访问 https://www.itying.com/category-93-b0.html
3 回复
第二种是报错的, Expected Boolean, got String with value “”,建议用第一种写法
更多关于uni-app 传入默认true的Boolean类型错误的实战教程也可以访问 https://www.itying.com/category-93-b0.html
我就是反馈第二种报错,需要官方修的呀,Boolean基本上都是这样写的


