DevecoStudio学习之Assigning the attribute ‘xxx‘ to the ‘xxx‘ decorated attribute ‘props‘ is not allowed

在父组件中的ForEach 中引用了子组件,需要给子组件传递参数,传递的是item 的类型,但是报如下错误,

Assigning the attribute ‘iconButton’ to the ‘@ObjectLink’ decorated attribute ‘props’ is not allowed. 

但是程序可以运行,但是一直标红看的也不舒服,如何解决呢?

解决方案:

使用as 强转,传递确认数据类型

posted on 2024-04-19 15:34  梁飞宇  阅读(12)  评论(0)    收藏  举报