naive-ui/demo/components/docCodeEditorMixin.js

16 lines
362 B
JavaScript
Raw Normal View History

2019-06-18 14:53:24 +08:00
import CodeMirror from 'codemirror'
import 'codemirror/mode/htmlmixed/htmlmixed'
2019-06-24 01:16:38 +08:00
import 'codemirror/theme/vibrant-ink.css'
2019-06-18 14:53:24 +08:00
export default {
mounted () {
this.$refs.doc.querySelectorAll('textarea').forEach(ta => {
CodeMirror.fromTextArea(ta, {
2019-06-23 19:52:26 +08:00
lineNumbers: false,
2019-06-24 01:16:38 +08:00
mode: 'htmlmixed',
theme: 'vibrant-ink'
2019-06-18 14:53:24 +08:00
})
})
}
}