打开的的网页是空白的(所用软件为Visual Studio Code)
这是router下的 index.js
import Vue from 'vue'
import Router from 'vue-router'
import index from '../components/index'
// import PageOne from '../components/PageOne'
// import PageTwo from '../components/PageTwo'
Vue.use(Router)
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: '首页',
component: Index,/*首页*/
// children:[/*子菜单*/
// {
// path: '/PageOne',
// name: '页面一',
// component: PageOne,
// },
// {
// path: '/PageTwo',
// name: '页面二',
// component: PageTwo,
// }
// ]
}
]
})
这是router下的mian.js
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})
这是App.vue的代码
<template>
<div id="app">
<router-view/>
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
<style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
这是App.vue里的main.js
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})