Package Exports
- vuejs-ace-editor
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vuejs-ace-editor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vuejs-ace-editor
A packaging of ace
Demo here: https://github.com/chairuosen/vue-ace-editor-demo/tree/vue2
How to use
Install
npm install vuejs-ace-editor
Require it in
components
of Vue optionsimport AceEditor from 'vuejs-ace-editor'; export default { ... components: { AceEditor }, ... }
Require the editor's mode/theme module in custom methods
export default { ... methods: { dataSumit() { //code here }, editorInit: function () { require('brace/ext/language_tools') //language extension prerequsite... require('brace/mode/html') require('brace/mode/javascript') //language require('brace/mode/less') require('brace/theme/monokai') require('brace/snippets/javascript') //snippet } }, ... }
Use the component in template
<AceEditor v-model="content" @init="editorInit" lang="javascript" theme="monokai" width="100%" height="200px" :options="{ enableBasicAutocompletion: true, enableLiveAutocompletion: true, fontSize: 14, highlightActiveLine: true, enableSnippets: true, showLineNumbers: true, tabSize: 2, showPrintMargin: false, showGutter: true, }" :commands="[ { name: 'save', bindKey: { win: 'Ctrl-s', mac: 'Command-s' }, exec: dataSumit, readOnly: true, }, ]" />
prop
v-model
is requiredprop
lang
andtheme
is same as ace-editor's docprop
height
andwidth
could be one of these:200
,200px
,50%