6 changed files with 62 additions and 120 deletions
@ -1,53 +0,0 @@ |
|||||
<template lang="html"> |
|
||||
<div id="editor" name="productcontent"> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
import {BASE_API} from '../../config'; |
|
||||
import E from 'wangeditor' |
|
||||
export default { |
|
||||
name: 'editoritem', |
|
||||
data() { |
|
||||
return { |
|
||||
// uploadPath, |
|
||||
editor: null, |
|
||||
} |
|
||||
}, |
|
||||
mounted() { |
|
||||
this.seteditor() |
|
||||
this.editor.txt.html(this.value) |
|
||||
}, |
|
||||
methods: { |
|
||||
seteditor() { |
|
||||
this.editor = new E( document.getElementById('editor') ) |
|
||||
this.editor.config.uploadImgShowBase64 = false // base 64 存储图片 |
|
||||
this.editor.config.uploadImgServer = `${BASE_API}/file/upload`// 配置服务器端地址 |
|
||||
this.editor.config.uploadImgHeaders = { |
|
||||
'Content-Type': 'multipart/form-data' |
|
||||
}// 自定义 header |
|
||||
this.editor.config.uploadFileName = 'file' // 后端接受上传文件的参数名 |
|
||||
this.editor.config.uploadImgMaxSize = 2 * 1024 * 1024 // 将图片大小限制为 2M |
|
||||
this.editor.config.uploadImgMaxLength = 6 // 限制一次最多上传 3 张图片 |
|
||||
this.editor.config.uploadImgTimeout = 3 * 60 * 1000 // 设置超时时间 |
|
||||
this.editor.create() |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
<style lang="css"> |
|
||||
.editor { |
|
||||
width: 100%; |
|
||||
margin: 0 auto; |
|
||||
position: relative; |
|
||||
z-index: 0; |
|
||||
} |
|
||||
.toolbar { |
|
||||
border: 1px solid #ccc; |
|
||||
} |
|
||||
.text { |
|
||||
border: 1px solid #ccc; |
|
||||
min-height: 500px; |
|
||||
} |
|
||||
</style> |
|
Loading…
Reference in new issue