vue两个页面跳转

如现在有两个页面Login和Home,路由配置在index.js中:
import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
import Login from '@/components/views/login/Login.vue'
import Home from '@/components/views/home.vue'


//懒加载方式,当路由被访问的时候才加载对应组件
// const Login = resolve => require(['@/components/views/login/Login'], resolve)


Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: '登录',
      component: Login
    },
    {
      path: '/Home',
      name: '首页',
      component: Home
    }
  ]
})

现在在Login中点击按钮跳转到Home,在Home中点击按钮也可以返回到Login:

Login页面:


   

{{ msg }}


   


home页面:


 

 

你可能感兴趣的:(vue)