代码拉取完成,页面将自动刷新
Vue.js syntax highlighting made easy, using highlight.js.
Simply install the npm package vue-hljs-with-line-number
:
npm install --save vue-hljs-with-line-number
In your main JavaScript file (eg. main.js
):
// Import Vue and vue-highlgihtjs
import Vue from 'vue'
import VueHljs from 'vue-highlightjs'
import 'vue-hljs-with-line-number/line-number.css';
// Tell Vue.js to use vue-hljs-with-line-number
Vue.use(VueHljs)
In your template, in order to highlight javascript code:
<!-- If your source-code lives in a variable called 'sourcecode' -->
<pre v-hljs="sourcecode">
<code class="javascript"></code>
</pre>
<!-- If you want to highlight hardcoded source-code -->
<pre v-hljs>
<code class="javascript">
const s = new Date().toString()
</code>
</pre>
Author: Chris Hager chris@linuxuser.at (https://www.metachris.com)
License: MIT
Contributors:
v1.0.5
v1.0.4
v1.0.3
v1.0.2
v1.0.1
v1.0.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。