chore(cli): vue global api change

This commit is contained in:
chenjiahan
2020-04-19 14:24:58 +08:00
parent 9b3b1e896c
commit e44d3955fc
4 changed files with 25 additions and 32 deletions
+4 -6
View File
@@ -1,4 +1,4 @@
import Vue from 'vue';
import { nextTick } from 'vue';
import VueRouter from 'vue-router';
import { isMobile, decamelize } from '../common';
import { config, documents } from 'site-desktop-shared';
@@ -48,7 +48,7 @@ function getRoutes() {
if (locales) {
routes.push({
path: '*',
redirect: route => `/${getLangFromRoute(route)}/`,
redirect: (route) => `/${getLangFromRoute(route)}/`,
});
} else {
routes.push({
@@ -66,7 +66,7 @@ function getRoutes() {
});
}
names.forEach(name => {
names.forEach((name) => {
const { component, lang } = parseName(name);
if (component === 'home') {
@@ -98,8 +98,6 @@ function getRoutes() {
return routes;
}
Vue.use(VueRouter);
export const router = new VueRouter({
mode: 'hash',
routes: getRoutes(),
@@ -113,7 +111,7 @@ export const router = new VueRouter({
});
router.afterEach(() => {
Vue.nextTick(() => window.syncPath());
nextTick(() => window.syncPath());
});
window.vueRouter = router;