- 報錯信息:
Invalid value for option “methods”: expected an Object, but got Function.
大致錯誤信息為: methods 希望是一個對象,但是得到了一個函數
- 錯誤代碼 :
methods(){
test(){
console.log(this.student);
}
}
- 修正代碼:
methods:{
test(){
console.log(this.student);
}
}
-
總結:
-
根據報錯翻譯大致意思判斷出是關於methods的錯誤,就去methods附近找錯,極大概率是語法寫錯,多寫括號或少寫。
-
原文鏈接:https://blog.csdn.net/qq_43521500/article/details/120958145