1. 程式人生 > >Vue報錯筆記(1)vue.js:515 [Vue warn]: Property or method "name" is not defined on the instance but refere

Vue報錯筆記(1)vue.js:515 [Vue warn]: Property or method "name" is not defined on the instance but refere

報錯:

vue.js:515 [Vue warn]: Property or method "name" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. 
(found in root instance)

解決:
ctrl+f 搜尋程式碼裡面哪裡使用了name,就是你使用了但是在data裡面沒有定義

name沒有定義,設定一個初始值即可

name 在data那裡沒有定義。
要這樣定義:

export default {
    name: 'app',
    data() {
        return {
           name: ''
        }
    },
    ......