Vue encountered "Cannot read property '__ob__' of undefined" solution

background

Write a new Vue component, compile an error, and the page cannot be displayed

There is a problem

If there is no return in data, even if there is no data in data(){}, this error will also occur. The error is reported because when I click to switch pages, there is no problem with the page routing, but the page cannot be switched

data() {}

solution

The data method of the scaffolding should be written like this, because the data function b in the process of instantiating Vue

data() {
    return {}
}

Guess you like

Origin blog.csdn.net/valsedefleurs/article/details/130390194