-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
52 lines (45 loc) · 1.37 KB
/
main.ts
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
49
50
51
52
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import filters from './filters'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
const hljs = require('highlight.js/lib/highlight');
const swift = require('highlight.js/lib/languages/swift');
require('highlight.js/styles/xcode.css');
hljs.registerLanguage('swift', swift);
Vue.config.productionTip = false
Vue.use(ElementUI);
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
})
Vue.directive('highlightjs', {
bind: function (el, binding) {
// on first bind, highlight all targets
let targets = el.querySelectorAll('code')
targets.forEach((target) => {
// if a value is directly assigned to the directive, use this
// instead of the element content.
target.innerHTML = binding.value || null
hljs.highlightBlock(target)
})
},
componentUpdated: function (el, binding) {
// after an update, re-fill the content and then highlight
let targets = el.querySelectorAll('code')
targets.forEach((target) => {
target.innerHTML = binding.value || null
hljs.highlightBlock(target)
})
}
})
new Vue({
// router,
store,
render: h => h(App),
// mounted() {
// // Prevent blank screen in Electron builds
// this.$router.push('/')
// }
}).$mount('#app')