【问题标题】:Why can I not edit in vue3 quill editor?为什么我不能在 vue3 quill 编辑器中编辑?
【发布时间】:2022-02-15 04:08:44
【问题描述】:

我正在用 vue3 quill 编辑器做一个测试,这是它目前的样子:

显示羽毛笔编辑器,但我无法编辑文本。

这是我的代码:

HelloWorld.vue

<template>
  <quill-editor
    v-model:value="state.content"
    :options="state.editorOption"
    :disabled="state.disabled"
    @blur="onEditorBlur($event)"
    @focus="onEditorFocus($event)"
    @ready="onEditorReady($event)"
    @change="onEditorChange($event)"
  />
</template>

<script>
import { reactive } from 'vue'
import { quillEditor } from 'vue3-quill'

export default {
  name: 'App',
  setup() {
    const state = reactive({
      content: '<p>2333</p>',
      _content: '',
      editorOption: {
        placeholder: 'core',
        modules: {
          // toolbars: [
            // custom toolbars options
            // will override the default configuration
          // ],
          // other moudle options here
          // otherMoudle: {}
        },
        // more options
      },
      disabled: false
    })

    const onEditorBlur = (quill) => {
      console.log('editor blur!', quill)
    }
    const onEditorFocus = (quill) => {
      console.log('editor focus!', quill)
    }
    const onEditorReady = (quill) => {
      console.log('editor ready!', quill)
    }
    const onEditorChange = ({ quill, html, text }) => {
      console.log('editor change!', quill, html, text)
      state._content = html
    }

    setTimeout(() => {
      state.disabled = true
    }, 2000)

    return { state, onEditorBlur, onEditorFocus, onEditorReady, onEditorChange }
  },
  components: {
    quillEditor
  }
}
</script>

命令

这些是我创建项目时执行的命令。

vue create . 
with default vue 3 options
npm i vue3-quill

我在这里找到了命令和代码: https://www.npmjs.com/package/vue3-quill

【问题讨论】:

    标签: vue.js npm vuejs3 quill


    【解决方案1】:

    线条:

    setTimeout(() => {
       state.disabled = true
    }, 2000)
    

    禁用编辑器。 只需删除它们或将 true 替换为 false

    【讨论】:

      猜你喜欢
      • 2021-08-05
      • 1970-01-01
      • 2022-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-06
      • 1970-01-01
      • 2010-09-30
      相关资源
      最近更新 更多