dev_2022-03-03
e 3 years ago
parent 73a317582c
commit 2f6ea7ff59
  1. 2
      .gitignore
  2. 15
      src/components/quill/index.vue

2
.gitignore vendored

@ -2,7 +2,7 @@
node_modules
/dist
example.html
favicon.ico
#favicon.ico
# local env files
.env.local
.env.*.local

@ -1,14 +1,12 @@
<template>
<div class="quill" ref="quill" :class="classes">
<div ref="editor" :style="styles" v-loading="loading"></div>
<el-upload
:headers="headers"
:action="this.api.fileupload"
:before-upload="beforeUpload"
:on-success="editorUploadSuccess"
style="display: none"
>
style="display: none">
<el-button class="editorUpload" type="primary">点击上传</el-button>
</el-upload>
</div>
@ -180,11 +178,16 @@
//
if (res.data.filesResult.fileUrl) {
//
let length = quill.getSelection().index;
let lengths;
if ( quill.getSelection() == null){
lengths = 1
}else{
lengths = quill.getSelection().index;
}
// res
quill.insertEmbed(length, 'image', res.data.filesResult.fileUrl)
quill.insertEmbed(lengths, 'image', res.data.filesResult.fileUrl)
//
quill.setSelection(length + 1)
quill.setSelection(lengths + 1)
} else {
this.$message.success('图片插入失败')
}

Loading…
Cancel
Save