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

在父组件中的ForEach 中引用了子组件,需要给子组件传递参数,传递的是item 的类型,但是报如下错误,
Assigning the attribute ‘iconButton’ to the ‘@ObjectLink’ decorated attribute ‘props’ is not allowed. 但是程序可以运行,但是一直标红看的也不舒服,如何解决呢?Assigning the attribute ‘iconButton‘ to the ‘@ObjectLink‘ decorated attribute ‘props‘ is not allowed_第1张图片

Assigning the attribute ‘iconButton‘ to the ‘@ObjectLink‘ decorated attribute ‘props‘ is not allowed_第2张图片
解决方案:
使用as 强转,传递确认数据类型(可能官方的问题,有知道的麻烦评论区说下,谢谢)
Assigning the attribute ‘iconButton‘ to the ‘@ObjectLink‘ decorated attribute ‘props‘ is not allowed_第3张图片

你可能感兴趣的:(开发语言,鸿蒙)