极品女神无套呻吟啪_亚洲成人免费影视_中文有码久久_eeusswww电影天堂国产_玖玖玖国产精品

行業(yè)新聞

    wordpress 代碼高亮使用 highlight.js 突出顯示 Vue 中的代碼

    2022-06-23    來(lái)源:www.bjcthy.com

    使用 .js 突出顯示 Vue 中的代碼

    VUE .js

    當(dāng)有些網(wǎng)頁(yè)有在線編輯頁(yè)面時(shí)wordpress 代碼高亮wordpress網(wǎng)站制作,我們不希望每個(gè)代碼類型都一樣

    1、高亮介紹wordpress 代碼高亮wordpress做網(wǎng)站,在main.js文件中全局導(dǎo)入

    import Vue from 'vue'
    <p><img src='http://pic1.zhimg.com/v2-5345c468ed9eb88e33347ec07a7e03bc_b.gif' alt='wordpress 代碼高亮_syntaxhighlighter動(dòng)態(tài)高亮代碼_wordpress 代碼高亮'/></p>
    import App from './App.vue'
    import $ from 'jquery'
    import ElementUI from 'element-ui'
    import 'element-ui/lib/theme-chalk/index.css';
    import router from "./router/index.js"
    <p><img src='http://img.php.cn/upload/jscode/000/120/096/5dc3b565c3d45983.jpg' alt='syntaxhighlighter動(dòng)態(tài)高亮代碼_wordpress 代碼高亮_wordpress 代碼高亮'/></p>
    import hljs from 'highlight.js';
    import 'highlight.js/styles/googlecode.css'
    Vue.use(hljs)
    Vue.use(ElementUI);
    <p><img src='http://pic4.zhimg.com/50/v2-0f04032f99dcd37457ecde86a739c98d_hd.jpg' alt='syntaxhighlighter動(dòng)態(tài)高亮代碼_wordpress 代碼高亮_wordpress 代碼高亮'/></p>
    Vue.config.productionTip = false
    Vue.directive('highlight',function(el){
    	let highlight = el.querySelectorAll("pre code");
    	highlight.forEach((block) =>{
    <p><img src='http://img-blog.csdnimg.cn/20210215175417414.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM2MDE4NTk4,size_16,color_FFFFFF,t_70#pic_center' alt='syntaxhighlighter動(dòng)態(tài)高亮代碼_wordpress 代碼高亮_wordpress 代碼高亮'/></p>
    		hljs.highlightBlock(block)
    	})
    })
    <p><img src='http://boke.yigujin.cn/img/2019/190703_gaoliang2.png' alt='wordpress 代碼高亮_wordpress 代碼高亮_syntaxhighlighter動(dòng)態(tài)高亮代碼'/></p>
    new Vue({
    	router,
      render: h => h(App),
    }).$mount('#app')
    

    文章來(lái)自互聯(lián)網(wǎng),侵權(quán)請(qǐng)聯(lián)系刪除,文章闡述觀點(diǎn)來(lái)自文章出處,并不代表本站觀點(diǎn)。 www.bjcthy.com



X