如图所示,当值的为对象的时候,上面的写法编译会红色警告,内容以下。因此为了消除警告/,咱们须要换个方式vue
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类型的时候。
这个时候就消除了呀,警告虽然编译没啥问题,可是强迫症看着不舒服,ahhhhspa