Invalid prop: type check failed for prop "percent". Expected Number with value 100, got String with value "100".
时间: 2023-10-18 15:31:00 浏览: 150
这个错误出现的原因是因为组件的属性"percentage"被传递了一个字符串值"100",而不是期望的数字类型。根据引用,期待的类型是Number,而不是String。同样的错误也在引用和中出现,它们的期望类型也是Number,而不是String或Function。
为了解决这个错误,需要确保将"percentage"属性设置为一个数字类型的值。根据引用的修改,可以将"percentage"属性设置为0,以确保它是一个有效的数字值。另外,在引用中,可以使用parseFloat函数将字符串转换为浮点数,以确保"percentage"属性是一个数字类型的值。通过这样的修改,就可以解决"Invalid prop: type check failed for prop 'percentage'"的错误,使得属性"percentage"的值符合期望的类型。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [Invalid prop: type check failed for prop “percentage“. Expected Number with value 2.06, got String...](https://blog.csdn.net/weixin_44273026/article/details/121740509)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [Invalid prop: type check failed for prop “percentage“. Expected Number with value NaN, got ...](https://blog.csdn.net/weixin_43606967/article/details/122087562)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文