kEditor.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <!--
  2. * @Description: 对vue-quill-editor封装
  3. * @Author: kcz
  4. * @Date: 2020-03-30 12:44:03
  5. * @LastEditors: kcz
  6. * @LastEditTime: 2020-04-26 19:21:27
  7. -->
  8. <template>
  9. <quillEditor
  10. :style="{ height: `${record.options.height}px` }"
  11. :value="value"
  12. ref="vueQuillEditor"
  13. class="ql-editor-class"
  14. :class="{ chinesization: record.options.chinesization }"
  15. :options="editorOption"
  16. :disabled="record.options.disabled || parentDisabled"
  17. @blur="onEditorBlur($event)"
  18. @focus="onEditorFocus($event)"
  19. @change="onEditorChange($event)"
  20. >
  21. </quillEditor>
  22. </template>
  23. <script>
  24. import { quillEditor } from "vue-quill-editor"; //调用编辑器
  25. import "quill/dist/quill.core.css";
  26. import "quill/dist/quill.snow.css";
  27. import "quill/dist/quill.bubble.css";
  28. export default {
  29. name: "editor",
  30. props: ["value", "record", "parentDisabled"],
  31. components: { quillEditor },
  32. data() {
  33. return {
  34. editorOption: {
  35. placeholder: this.record.options.placeholder
  36. }
  37. };
  38. },
  39. methods: {
  40. onEditorBlur() {}, // 失去焦点事件
  41. onEditorFocus() {}, // 获得焦点事件
  42. onEditorChange(e) {
  43. this.$emit("change", e.html);
  44. }
  45. }
  46. };
  47. </script>
  48. <style lang="less" scoped>
  49. .ql-editor-class {
  50. -webkit-box-sizing: border-box;
  51. box-sizing: border-box;
  52. line-height: 1.42;
  53. height: 100%;
  54. outline: none;
  55. padding: 0 0 66px;
  56. tab-size: 4;
  57. -moz-tab-size: 4;
  58. text-align: left;
  59. word-wrap: break-word;
  60. }
  61. </style>