Skip to content

Commit

Permalink
feat(core): support config h5 router base
Browse files Browse the repository at this point in the history
  • Loading branch information
allen-zh committed Sep 6, 2019
1 parent e1c8446 commit b24b764
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/mars-core/src/h5/app-shell/main.js
Expand Up @@ -5,7 +5,8 @@


/* globals Vue */
import Vue from 'vue';
// import Vue from 'vue';
import {Vue} from '../index';

// 引入公共样式
import './mars-base.css';
Expand Down
10 changes: 8 additions & 2 deletions packages/mars-core/src/h5/app-shell/router.js
Expand Up @@ -3,19 +3,25 @@
* @author mars
*/

import Vue from 'vue';
// import {} from 'vue';
import {config as appConfig, Vue} from '../index';
import VueRouter from 'vue-router';
import browserHistory from './browserHistory';
import {routes, mode} from './export';
Vue.use(VueRouter);

const {router: routerConfig = {}} = appConfig;
const {base, mode: runtimeMode} = routerConfig;

routes.push({
path: '*',
redirect: routes[0].path
});

const router = new VueRouter({
mode, routes
mode: runtimeMode || mode || 'history',
base: base || '/',
routes
});

function guid() {
Expand Down
6 changes: 5 additions & 1 deletion packages/mars-core/src/h5/index.js
Expand Up @@ -5,5 +5,9 @@
*/
export {default as Vue} from 'vue';
export const config = {
$platform: 'h5'
$platform: 'h5',
router: {
mode: undefined,
base: undefined
}
};

0 comments on commit b24b764

Please sign in to comment.