Commit 6b55af14 by 陈超

A

parent dc64c2c0
......@@ -7,11 +7,13 @@
:mode="mode"
@onChange="onChange"
@onCreated="onCreated" />
</div>
</template>
<script>
import Vue from 'vue'
import {Uploader} from '@/util/oss'
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
import "@wangeditor/editor/dist/css/style.css"
......@@ -30,7 +32,16 @@
MENU_CONF: {
uploadImage: {
async customUpload(file, insertFn) {
let r = await UPLOADER.upload('images', file)
let bucket = ''
if (file.type.startsWith('image')) {
bucket = 'images'
} else if (file.type.startsWith('video')) {
bucket = 'videos'
} else {
req.onError('不支持的文件格式')
return
}
let r = await Uploader.upload(bucket, file)
insertFn(r.url, '', r.url)
}
}
......@@ -56,12 +67,13 @@
this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错
},
onChange(editor) {
//console.log(editor.getHtml())
this.$emit('changed', editor.getHtml())
}
},
mounted() {
this.html = this.content
mounted() {
// alert("[ mounted ] this.content: "+this.content)
this.html = this.content
},
beforeDestroy() {
if(this.editor) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment