Login

Record a problem: nuxt page, click to enter normal, refresh and report an error

Author:neo yang Time:2021/12/30 Read: 7693

Record a problem: nuxt page, click to enter normal, refresh and report an error.

The problem is in a layout.

 data() {
return {
routeData: {},//This turned out to be this.$route, and an error was reported after refreshing. After changing it to an empty object, everything will be fine.
...
}
...
watch: {
...
"$store.state.routeData": {
handler: function (newVal, oldVal) {
console.log(this.$store.state.routeData);
this.routeData = this.$store.state.routeData;

},
},
},

In the ssr mode of nuxt, a refresh error occurs. You can check three places: data, asyncData, and store.

tags:


copyright © www.lyustu.com all rights reserved.
Theme: TheMoon V3.0. Author:neo yang