只读编辑器
在日常开发项目中我们偶尔会遇到只读编辑器中内容的情况,那么 IEditor 是可以支持这样的需求的。
只读效果
只需配置 readonly 参数即可实现只读功能。默认为 false 。
改变只读状态
当前为 只读 状态
示例代码
<div id="ied" class="ied" ref="ied"></div>
export default {
// 略去其他代码
data() {
return {
readonly: true,
};
},
mounted() {
this.edit = new IEditor({
el: this.$refs.ied,
readonly: this.readonly,
});
this.edit.init();
},
methods: {
changeStatus() {
this.readonly = !this.readonly;
this.edit.setStatus(this.readonly);
},
},
// 略去其他代码
};