Преглед изворни кода

fix: 修复撤销/重做按钮无反应问题(绑定handler和图标)

Developer пре 2 недеља
родитељ
комит
15dfeb2af9
2 измењених фајлова са 15 додато и 2 уклоњено
  1. BIN
      dist.zip
  2. 15 2
      src/components/editor/index.vue

+ 15 - 2
src/components/editor/index.vue

@@ -13,10 +13,17 @@ import 'quill/dist/quill.core.css'
 import 'quill/dist/quill.snow.css'
 import 'quill/dist/quill.bubble.css'
 import {
-    quillEditor
+    quillEditor,
+    Quill
 } from 'vue-quill-editor'
+const undoIcon = Quill.import('ui/icons')['undo']
+const redoIcon = Quill.import('ui/icons')['redo']
 const toolbarOptions = [
-    [{'undo': []}, {'redo': []}], // 撤销,重做
+    [{
+        'undo': undoIcon
+    }, {
+        'redo': redoIcon
+    }], // 撤销,重做
     ['bold', 'italic', 'underline', 'strike'], // 加粗,斜体,下划线,删除线
     ['blockquote', 'code-block'], //引用,代码块
     [{
@@ -78,6 +85,12 @@ export default {
                     toolbar: {
                         container: toolbarOptions,
                         handlers: {
+                            undo: function () {
+                                this.quill.history.undo()
+                            },
+                            redo: function () {
+                                this.quill.history.redo()
+                            },
                             image: function (value) {
                                 if (value) {
                                     // 调用element的图片上传组件