Vue $route is not defined

后端 未结 6 1231
面向向阳花
面向向阳花 2021-01-01 09:05

I\'m learning Vue router. And I want to made programmatic navigation without using in templates file. My router and view:

 ro         


        
6条回答
  •  死守一世寂寞
    2021-01-01 09:51

    For those attempting to use es6 arrow functions, another alternative to @Kishan Vaghela is:

    methods: {
            gotoRegister() {
                this.$router.push('register')
            }
        }
    

    as explained in the first answer of Methods in ES6 objects: using arrow functions

提交回复
热议问题