X-Highlight-Vue
A Vue.js plugin use for Syntax highlighting.
Example
# git clone https://github.com/OXOYO/X-Highlight-Vue.git# install dependenciesnpm install# serve with hot reload at localhost:8080npm run dev
Usage
Packages install
npm install x-highlight --save
main.js
import XHighlight from 'x-highlight'import 'x-highlight/dist/css/XHighlight.css'// highlight themeimport 'highlight.js/styles/zenburn.css' Vue.use
demo.vue
<XHighlight class="x-highlight" :title="options.title" :lang="options.lang" :show="options.show" :tool="options.tool" :maxHeight="options.maxHeight" :locale="options.locale" :data="options.data"></XHighlight>
Options
Prop | Type | Default | Describe |
---|---|---|---|
title | String | '' | |
lang | String | 'JavaScript' | |
show | Array | ['title', 'lang', 'num', 'nodata'] | |
tool | Array | ['full-screen', 'select-all', 'copy'] | |
maxHeight | Number | ||
locale | String | 'zh' | |
nodata | String | 暂无数据... | |
data | '' |