forked from didi/mand-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
48 lines (43 loc) · 1.33 KB
/
main.js
File metadata and controls
48 lines (43 loc) · 1.33 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
47
48
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import VueClipboard from 'vue-clipboard2'
import VueTooltip from 'v-tooltip'
import { setScale } from './assets/js/util'
if (process.env.NODE_ENV === 'production') {
const hostname = location.hostname
const pathname = location.pathname
if (hostname === 'didi.github.io') {
__webpack_public_path__ = '/mand-mobile/'
} else if (hostname === 'mand-mobile.gitee.io') {
if (~pathname.indexOf('/1x-doc')) {
__webpack_public_path__ = '/1x-doc/'
} else if (~pathname.indexOf('/2x-doc')) {
__webpack_public_path__ = '/2x-doc/'
} else {
__webpack_public_path__ = '/docs/'
}
}
}
Vue.config.productionTip = false
Vue.use(VueClipboard)
Vue.use(VueTooltip)
if ($(window).width() > 750) {
setScale(0.5)
}
window.jumpAnchor = (anchor) => {
if (!anchor || !document.getElementById(decodeURIComponent(anchor))) {
return
}
window.document.getElementById(decodeURIComponent(anchor)).scrollIntoView()
let hash = window.location.hash.replace(/\?.*/, '')
window.location.hash = `${hash}?anchor=${anchor}`
}
/* eslint-disable no-new */
new Vue({
el: '#app',
render: h => h(App),
router,
})