简体   繁体   English

vuejs 的 toast-ui 编辑器中的 v-model

[英]v-model in toast-ui editor for vuejs

toast-ui vue-editor doesn't support v-model to bind the value. toast-ui vue-editor 不支持 v-model 绑定值。 What should be done to bind the input value while using toast-ui vue-editor?使用 toast-ui vue-editor 时应该怎么做绑定输入值? I have setup toast-ui:我已经设置了 toast-ui:

import '@toast-ui/editor/dist/toastui-editor.css';
import { Editor } from '@toast-ui/vue-editor';
export default {
  components: {
    editor: Editor
  }
}
<editor
    :initialValue="form.explanation"
    height="500px"
    initialEditType="markdown"
    previewStyle="vertical"
    ref="toastuiEditor"
  />

I need to bind my form data and save it to database.我需要绑定我的表单数据并将其保存到数据库中。

A simple and quick solution is to use一个简单快捷的解决方案是使用

   @ change = "getHtml" 

in the data create在数据创建

form: {
       text: ""
}

then create a method called然后创建一个方法调用

getHtml () {
  let html = this. $ refs.toastuiEditor.invoke ('getHtml');

  this.form.text= html;
} 

where form.text would be who would get the value of the editor其中 form.text 将是谁将获得编辑器的值

My mother tongue is not English so I apologize if I made a spelling mistake我的母语不是英语所以如果我拼写错误我很抱歉

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM