使用uni-app的記錄1,對於子組件中prosps的默認值警告處理

image.png
如圖所示,當值的爲對象的時候,上面的寫法編譯會紅色警告,內容以下。因此爲了消除警告/,咱們須要換個方式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>

image.png

警告的時候就消除了。
對於對象爲Array類型的時候。
image.png
這個時候就消除了呀,警告雖然編譯沒啥問題,可是強迫症看着不舒服,ahhhhspa

相關文章
相關標籤/搜索