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

image.png
如图所示,当值的为对象的时候,上面的写法编译会红色警告,内容如下。所以为了消除警告/,我们需要换个方式

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 --->  at src/components/conversion_chat/chat_content_item.vue
13:37:05.398 

image.png

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

你可能感兴趣的:(vue.js,hbuilder)