blivechat/frontend/src/main.js

46 lines
1019 B
JavaScript
Raw Normal View History

2019-05-21 19:15:12 +08:00
import Vue from 'vue'
import VueRouter from 'vue-router'
2019-06-10 18:38:21 +08:00
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
2019-06-12 13:55:49 +08:00
import axios from 'axios'
2019-05-21 19:15:12 +08:00
import App from './App.vue'
2019-06-11 12:51:25 +08:00
import Layout from './layout'
2019-06-09 12:37:59 +08:00
import Home from './views/Home.vue'
2019-06-16 23:04:30 +08:00
import StyleGenerator from './views/StyleGenerator'
2019-06-17 12:29:25 +08:00
import Room from './views/Room.vue'
2019-06-09 12:37:59 +08:00
import NotFound from './views/NotFound.vue'
2019-05-21 19:15:12 +08:00
2019-06-12 13:55:49 +08:00
if (process.env.NODE_ENV === 'development') {
// 开发时使用localhost:80
axios.defaults.baseURL = 'http://localhost'
}
2019-05-21 19:15:12 +08:00
Vue.use(VueRouter)
2019-06-10 18:38:21 +08:00
Vue.use(ElementUI)
2019-05-21 19:15:12 +08:00
2019-06-09 12:37:59 +08:00
Vue.config.ignoredElements = [
/^yt-/
]
2019-05-21 19:15:12 +08:00
const router = new VueRouter({
mode: 'history',
routes: [
2019-06-11 12:51:25 +08:00
{
path: '/',
component: Layout,
children: [
2019-06-11 18:52:00 +08:00
{path: '', component: Home},
{path: 'stylegen', name: 'stylegen', component: StyleGenerator}
2019-06-11 12:51:25 +08:00
]
},
2019-05-21 19:15:12 +08:00
{path: '/room/:roomId', name: 'room', component: Room},
{path: '*', component: NotFound}
]
})
new Vue({
render: h => h(App),
router
}).$mount('#app')