使用uni-app的记录1,对于子组件中prosps的默认值警告处理
文章目录

如图所示,当值的为对象的时候,上面的写法编译会红色警告,内容如下。所以为了消除警告/,我们需要换个方式
13:37:05.313 [Vue warn]: Invalid default value for prop "msgContent": Props with type Object/Array must use a factory function to return the default value.
13:37:05.335 found in
13:37:05.377 ---> <ChatContent> at src/components/conversion_chat/chat_content_item.vue
13:37:05.398 <Root>

警告的时候就消除了。
对于对象为Array类型的时候。
这个时候就消除了呀,警告虽然编译没啥问题,但是强迫症看着不舒服,ahhhh

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论