We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm install highlight.js --save 或 yarn add highlight.js
import Hljs from "highlight.js"; export const highlight = (el: any) => { const blocks = el.querySelectorAll("pre code"); blocks.forEach((block: any) => { Hljs.highlightBlock(block); }); };
import { highlight } from "@/utils/directive"; Vue.directive("highlight", highlight); // 样式文件在 node_modules/highlight.js/style/ 中可以找到 @import "../assets/atom-one-dark";
<div v-highlight v-html="articleDetail.content"></div>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Vue集成highlight.js
一、安装highlight.js
二、封装自定义指令
三、引入指令和样式
四丶使用指令
The text was updated successfully, but these errors were encountered: