标签:run outer net node export port 修改端口 使用 https
cnpm install vue-cli -g
vue init webpack projectName
npm run dev
修改端口运行
PORT=8089 node ./build/dev-server.js
cnpm install vue-router --save-dev
import VRouter from ‘vue-router‘
//使用
Vue.use(VRouter)
import Home from ‘@/page/home‘
import News from ‘@/page/news‘
let router = new VRouter({
routes:[
{path:‘/home‘,component:Home},
{path:‘/news‘,component:News}
]
})
new Vue({
el: ‘#app‘,
router,
template: ‘<App/>‘,
components: { App }
})
在跟组件中 App.vue中 加入<router-view></router-view>,确定显示区域
localhost:8080/#/home
localhost:8080/#/news
import Vue from ‘vue‘
//路由相关
//载入vue-router
import VRouter from ‘vue-router‘
//使用
Vue.use(VRouter)
//导入模块
import Home from ‘@/page/home‘
import News from ‘@/page/news‘
export default new VRouter({
routes:[
{path:‘/home‘,component:Home},
{path:‘/news‘,component:News}
]
})
main.js
import router from ‘@/route/index‘
标签:run outer net node export port 修改端口 使用 https
原文地址:http://www.cnblogs.com/MrsQiu/p/7083324.html