vue跳转路由

版权声明:如果您对这个文章有任何异议,那么请在文章评论处写上你的评论。 如果您觉得这个文章有意思,那么请分享并转发,或者也可以关注一下表示您对我们文章的认可与鼓励。 愿大家都能在编程这条路,越走越远。 https://blog.csdn.net/weixin_44369568/article/details/91457786

1、下载 npm i vue-router

2、main.js

import VueRouter from ‘vue-router’

import Index from ‘./pages/index.vue’

2、main.js

Vue.use(VueRouter)

3、let router = new VueRouter({

routes: [{
    name: 'index',
    path: '/index',
    component:Index
}]

})

4、定义路由

new Vue({

el:"#box",
router

})

5、跳转链接 index.vue

</router-link

猜你喜欢

转载自blog.csdn.net/weixin_44369568/article/details/91457786
今日推荐