Tag Archives: Can’t read property ‘push’ of undefined error

Can’t read property ‘push’ of undefined [How to Solve]

Can read property ‘push’ of undefined in Vue.

Please check pages. JSON and   Is there a path you filled in in router/index.js.

In router/index.js   The path in the file must correspond to the address in pages.json, and must be preceded by the/symbol

{		
        path: '/pages/index',
		name: 'index',	
},

Page. JSON file

{
            "path" : "pages/index locaton",
            "style" :                                                                                    

            
        }

There is no/sign in front of the path here.

Can be used in the page, the method is not unique( (not recommended)

this.$Router.push({
					name: 'name',
				});
this.$Router.push({path:'/name'});