0.2.0 • Published 2 months ago

vue-highlight-code v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Highlight Code and Content editor for Vue.js

Import the npm package and only one prop to show highlightCode and editor

vue 3

yarn add highlight.js vue-highlight-code

live demo

bitSandBox-demo(web-IDE部分模块的简单实现)

stackblitz

NXGUK Z% L$P EQCLJZ6TZY

1. use in Vue3

Install the vue-highlight-code package from NPM and highlight.js:

yarn add highlight.js vue-highlight-code

import the component and style

import { HighCode } from 'vue-highlight-code';
import 'vue-highlight-code/dist/style.css';
export default {
    components: {
      HighCode
    },
}

<HighCode></HighCoder>

Component Props

propdescriptiontypedefault
codeValueHighlight Code SourceString''
textEditorCodeText EditorBoolean'false'
langHighlight Code TypeStringjavascript (such as 'vue','html','css)
themeComponent Highlight Code themeStringdefault: dark(only 'dark','light')
codeLinesShow Code linesBooleanfalse
langNameHighlight Code Name (Upper left corner display)String
widthcomponent style widthString620px
heightcomponent style heightString
maxWidthcomponent style max-widthString
maxHightcomponent style max-heightStringString
fontSizehighlight code font-sizeString-
scrollStyleBoolcomponent scroll bar styleBooleantrue
copywhether the code can copyBooleantrue
borderRadiuscomponent style border_radiusString10px

emit

emitdescriptiontypeparameter
getCodeValueThe emit method is triggered when the edit content changesFunctionfunction(contentValue: String): void

Get real-time editing code content

create ref in the HighCode component instance get the modelValue

<script setup>
const H = ref(null)
onMounted(() => {
  console.log(H.value.modelValue)
})
<script>
<HighCode ref="H" ></HighCode>
0.1.20

2 months ago

0.1.21

2 months ago

0.2.0

2 months ago

0.1.17

2 months ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7-1

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago