VUE 路由配置(包含main.js index.js APP.vue 三大配置)
main.jsimport Vue from 'vue'import App from './App'import router from './router'import Element from 'element-ui'import 'element-ui/lib/theme-chalk/index.css'Vue.use(Element);Vue.config.produ...
main.js
import Vue from 'vue'
import App from './App'
import router from './router'
import Element from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(Element);
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})
src/router/index.js
import Vue from 'vue'
import Router from 'vue-router'
import Login from '../components/Login'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/Login',
name: 'Login',
component: Login
},
{
path:"/login1",
component:() => import('@/components/login1.vue')
}
],
mode: "history"//干掉地址栏里边的#号键
})
App.vue 展示Vue
<template>
<div id="app">
<router-view />
</div>
</template>
<script>
export default {
name: 'App',
data () {
return {
}
}
}
</script>
<style>
</style>
---------------------
转载自
作者:HinKai
来源:CSDN
原文:https://blog.csdn.net/HinKai/article/details/86501558
更多推荐
所有评论(0)