#I3BMNS 代码块高亮,增加判空和状态判断
This commit is contained in:
@@ -32,6 +32,18 @@ let vue = new Vue({
|
||||
return h(App);
|
||||
}
|
||||
});
|
||||
|
||||
// 注册一个全局自定义指令
|
||||
import hljs from 'highlight.js'
|
||||
import 'highlight.js/styles/googlecode.css'
|
||||
|
||||
Vue.directive('highlight', function (el) {
|
||||
let blocks = el.querySelectorAll('pre code');
|
||||
blocks.forEach((block) => {
|
||||
hljs.highlightBlock(block);
|
||||
})
|
||||
});
|
||||
|
||||
export default vue;
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<div ref="pageContent" class="wiki-page-content">
|
||||
<div v-html="pageShowDetail" class="markdown-body" v-if="wikiPage.editorType == 2"></div>
|
||||
<div v-html="pageShowDetail" class="markdown-body" v-if="wikiPage.editorType == 2" v-highlight></div>
|
||||
<div v-html="pageShowDetail" class="wang-editor-body" v-else></div>
|
||||
</div>
|
||||
<div style="margin-top: 40px; font-size: 14px;">
|
||||
|
||||
Reference in New Issue
Block a user