2018-05-02 01:59:42 +00:00
|
|
|
import 'babel-polyfill'
|
2018-04-04 10:39:21 +00:00
|
|
|
import '../components/style.js'
|
|
|
|
import './index.less'
|
|
|
|
import 'highlight.js/styles/solarized-light.css'
|
|
|
|
import Vue from 'vue'
|
2018-11-27 10:25:38 +00:00
|
|
|
import VueI18n from 'vue-i18n'
|
2018-04-04 10:39:21 +00:00
|
|
|
import VueRouter from 'vue-router'
|
|
|
|
import VueClipboard from 'vue-clipboard2'
|
|
|
|
import routes from './routes'
|
|
|
|
import Md from './components/md'
|
|
|
|
import Api from './components/api'
|
2018-04-08 13:17:20 +00:00
|
|
|
import './components'
|
2018-04-04 10:39:21 +00:00
|
|
|
import demoBox from './components/demoBox'
|
2018-05-08 03:20:07 +00:00
|
|
|
import demoContainer from './components/demoContainer'
|
2018-11-27 10:25:38 +00:00
|
|
|
import zhCN from './theme/zh-CN'
|
|
|
|
import enUS from './theme/en-US'
|
|
|
|
import { isZhCN } from './util'
|
2018-04-04 10:39:21 +00:00
|
|
|
|
2018-07-14 09:59:25 +00:00
|
|
|
const mountedCallback = {
|
|
|
|
install: (Vue, options) => {
|
|
|
|
Vue.directive('mountedCallback', {
|
|
|
|
inserted: function (el, binding, vnode) {
|
|
|
|
binding.value(vnode)
|
|
|
|
},
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
Vue.use(mountedCallback)
|
2018-04-04 10:39:21 +00:00
|
|
|
Vue.use(VueClipboard)
|
|
|
|
Vue.use(VueRouter)
|
2018-11-27 10:25:38 +00:00
|
|
|
Vue.use(VueI18n)
|
2018-04-04 10:39:21 +00:00
|
|
|
Vue.component(Md.name, Md)
|
|
|
|
Vue.component(Api.name, Api)
|
|
|
|
Vue.component('demo-box', demoBox)
|
2018-05-08 03:20:07 +00:00
|
|
|
Vue.component('demo-container', demoContainer)
|
2018-04-04 10:39:21 +00:00
|
|
|
|
2018-11-27 10:25:38 +00:00
|
|
|
const i18n = new VueI18n({
|
|
|
|
locale: isZhCN(location.pathname) ? zhCN.locale : enUS.locale,
|
|
|
|
messages: {
|
|
|
|
[enUS.locale]: { message: enUS.messages },
|
|
|
|
[zhCN.locale]: { message: zhCN.messages },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2018-04-04 10:39:21 +00:00
|
|
|
const router = new VueRouter({
|
|
|
|
mode: 'history',
|
2018-07-28 05:43:23 +00:00
|
|
|
fallback: false,
|
2018-04-04 10:39:21 +00:00
|
|
|
routes,
|
|
|
|
})
|
|
|
|
new Vue({
|
|
|
|
el: '#app',
|
2018-11-27 10:25:38 +00:00
|
|
|
i18n,
|
2018-04-04 10:39:21 +00:00
|
|
|
router,
|
|
|
|
})
|