app.js
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import Vue from 'vue';
import Router from 'vue-router';
import Promise from 'promise-polyfill';
import App from './pages/app';
import Routers from './pages';
import yohoPluginCore from './plugins/yoho-plugin-core';
import yohoPluginAuth from './plugins/yoho-plugin-auth';
import './filters';
import './directives';
import 'iview/dist/styles/iview.css';
import 'font-awesome/css/font-awesome.css';
// 兼容IE的Function没有name属性为题,为了修复iView的bug
if (!(function f() {}).name) {
Object.defineProperty(Function.prototype, 'name', { //eslint-disable-line
get: function() {
let name = (this.toString().match(/^function\s*([^\s(]+)/) || [])[1];
Object.defineProperty(this, 'name', { value: name });
return name;
}
});
}
// 使用了webpack code spliting IE下需要promise ployfill
if (!window.Promise) {
window.Promise = Promise;
}
let router = new Router({
routes: Routers,
mode: 'history'
});
Vue.use(yohoPluginCore, {router});
Vue.use(yohoPluginAuth);
Vue.render({
el: '#app',
router,
template: '<App/>',
components: {App}
});