$ gnpm install vue3-ace-editor
A packaging of ace. Inspired by vue2-ace-editor, but supports Vue 3
Install
yarn add vue3-ace-editor
Register it in components of Vue options
import { VAceEditor } from 'vue3-ace-editor';
export default {
data,
methods,
...
components: {
VAceEditor,
},
}
Use the component in template
<v-ace-editor
v-model:value="content"
@init="editorInit"
lang="html"
theme="chrome"
style="height: 300px" />
prop v-model:value is required. <v-ace-editor> has no height by default. Its height must be specified manually, or set both min-lines and max-lines to make the editor's height auto-grow.
prop lang, theme is same as ace-editor's doc
width / height props needed.readonly: This Boolean attribute indicates that the user cannot modify the value of the control.placeholder: A hint to the user of what can be entered in the control.wrap: Indicates whether the control wraps text.printMargin: A short hand of showPrintMargin and printMarginColumn.minLines and maxLines: Specifiy the minimum and maximum number of lines.focus, blur, selectAll provided as shortcuts.Using of ace-builds/webpack-resolver is removed due to bug https://github.com/CarterLi/vue3-ace-editor/issues/3. You MUST import theme and mode yourself. eg.
import 'ace-builds/src-noconflict/mode-text';
import 'ace-builds/src-noconflict/theme-chrome';
Find all supported themes and modes in node_modules/ace-builds/src-noconflict
MIT
Copyright 2013 - present © cnpmjs.org | Home |