File tree 4 files changed +20
-21
lines changed
4 files changed +20
-21
lines changed Original file line number Diff line number Diff line change 9
9
},
10
10
"dependencies" : {
11
11
"core-js" : " ^3.30.2" ,
12
+ "highlight.js" : " ^11.8.0" ,
12
13
"jquery" : " ^3.7.0" ,
13
14
"multiple-select" : " ^1.6.0" ,
14
- "vue" : " ^2.6.10" ,
15
- "vue-highlight.js" : " ^3.1.0" ,
16
- "vue-router" : " ^3.0.6" ,
17
- "vuex" : " ^3.0.1"
15
+ "vue" : " ^2.7.14" ,
16
+ "vue-router" : " ^3.6.5" ,
17
+ "vuex" : " ^3.6.2"
18
18
},
19
19
"devDependencies" : {
20
20
"@vue/cli-plugin-babel" : " ^4.0.4" ,
Original file line number Diff line number Diff line change 1
1
import Vue from 'vue'
2
2
import App from './App.vue'
3
3
import './plugins/select'
4
- import './plugins/highlight'
5
4
import router from './router'
6
5
7
6
Vue . config . productionTip = false
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 25
25
<div v-if =" !isSource" >
26
26
<component :is =" componentLoader" />
27
27
</div >
28
- <highlight-code
29
- v-else
30
- lang =" vue"
31
- >
32
- {{ componentSource }}
33
- </highlight-code >
28
+ <pre v-else ><code class =" html" >{{ componentSource }}</code ></pre >
34
29
</div >
35
30
</div >
36
31
</template >
37
32
38
33
<script >
34
+ import hljs from ' highlight.js/lib/core'
35
+ import xml from ' highlight.js/lib/languages/xml'
36
+ import ' highlight.js/styles/default.css'
39
37
import registry from ' @/registry'
40
38
import Ads from ' @/components/Ads'
41
39
import MS from ' @/assets/MS'
@@ -87,14 +85,26 @@ export default {
87
85
},
88
86
isSource () {
89
87
this .updateAds ()
88
+ this .updateHighlight ()
90
89
}
91
90
},
91
+ mounted () {
92
+ hljs .registerLanguage (' xml' , xml)
93
+ this .updateHighlight ()
94
+ },
92
95
methods: {
93
96
updateAds () {
94
97
this .hideAds = true
95
98
setTimeout (() => {
96
99
this .hideAds = false
97
100
}, 500 )
101
+ },
102
+ updateHighlight () {
103
+ this .$nextTick (() => {
104
+ document .querySelectorAll (' pre code' ).forEach (el => {
105
+ hljs .highlightElement (el)
106
+ })
107
+ })
98
108
}
99
109
}
100
110
}
You can’t perform that action at this time.
0 commit comments