codeMirror使用:销毁codeMirror组件
文章目录
文章只是记录使用该插件的过程:
<template>
<div class="json-editor">
<textarea ref="textarea" />
</div>
</template>/**
导入对应的包
import .....
**/
// 创建
this.jsonEditor = CodeMirror.fromTextArea(this.$refs.textarea, {
lineNumbers: true,
mode: 'application/json',
gutters: ['CodeMirror-lint-markers'],
theme: 'rubyblue',
lint: true,
readOnly: true // 只读
})
// 销毁
this.jsonEditor.getWarpperElement().parentNode.removeChild(this.jsonEditor.getWarpperElement())
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论