如何解决highlightjs在vue?
通过路由切换过去的一个含有pre和code标签的页面,引入highlightjs并执行,结果页面没有任何变化,执行的时间用过afterEach,window.onload和setTimeo优艾设计网_设计百科ut都实验过,页面都不会高亮代码,请问各位大神解决办法?
megcjgm优艾设计网_PS百科 14小时前
So, simply add v-highlightjs
to each tag that is supposed to be highlighted. That will re-highlight those tags each time Vue inserts them into the DOM (router navigation to another component etc...)
shenme_2015 13小时前 优艾设计网_设计模板
you should not use that global init function, as it is intended to highlight all pre tags on page load, and is meant to be used on static pages.
360U3180755915 13小时前
Highlightjs offers a method for "Custom Initialization"with hljs.highlightBlock()
, which you shou优艾设计网_设计百科ld warp in a custom directive:
精彩评论