vue2 页面路由

 

vue官方文档

 

src/views/Login.vue

<template>
    <div>
      <h2>登录页</h2>
    </div>
</template>

<script>
    export default {
        name: "Login"
    }
</script>

 

router/index.js

import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Login from '@/views/Login'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/hello',
      name: 'HelloWorld',
      component: HelloWorld
    },{
      path: '/login',
      name: 'Login',
      component: Login
    }
  ]
})

 

posted @ 2020-09-29 22:15  方诚  阅读(136)  评论(0编辑  收藏  举报