Vue 報錯信息:
[Vue warn]: Method "msg" has already been defined as a data property.
[Vue warn]: Error in mounted hook: "TypeError: this.msg is not a function"
TypeError: this.msg is not a function ……
原因:
在 Vue 中:computed
(計算屬性);data
;props
都會被掛在在 vm 實例上,因此不能同名。
也不能與函數名同名。
鍵名優先級:props > data > methods