Commit dd10418a by H.wb.wang.peixun

Merge branch 'feature/v1/zmj' of…

Merge branch 'feature/v1/zmj' of http://git.nyinhong.com/school-paper/school-paper-admin-front into feature/v1/zmj
parents 7fd8f3a1 8660ec98
...@@ -56,13 +56,19 @@ export default { ...@@ -56,13 +56,19 @@ export default {
type: { type: {
type: String, type: String,
default: "url", default: "url",
} },
iconType: {
type: Array,
default: () => {
return ["link", "image", "video"]; // 链接、图片、视频
},
},
}, },
data() { data() {
return { return {
uploadUrl: process.env.VUE_APP_BASE_API + "/system/oss/upload", // 上传的图片服务器地址 uploadUrl: process.env.VUE_APP_BASE_API + "/system/oss/upload", // 上传的图片服务器地址
headers: { headers: {
Authorization: "Bearer " + getToken() Authorization: "Bearer " + getToken(),
}, },
Quill: null, Quill: null,
currentValue: "", currentValue: "",
...@@ -73,16 +79,16 @@ export default { ...@@ -73,16 +79,16 @@ export default {
modules: { modules: {
// 工具栏配置 // 工具栏配置
toolbar: [ toolbar: [
["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线 ["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线
["blockquote", "code-block"], // 引用 代码块 ["blockquote", "code-block"], // 引用 代码块
[{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表 [{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表
[{ indent: "-1" }, { indent: "+1" }], // 缩进 [{ indent: "-1" }, { indent: "+1" }], // 缩进
[{ size: ["small", false, "large", "huge"] }], // 字体大小 [{ size: ["small", false, "large", "huge"] }], // 字体大小
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题 [{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
[{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色 [{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
[{ align: [] }], // 对齐方式 [{ align: [] }], // 对齐方式
["clean"], // 清除文本格式 ["clean"], // 清除文本格式
["link", "image", "video"] // 链接、图片、视频 this.iconType, // 链接、图片、视频
], ],
}, },
placeholder: "请输入内容", placeholder: "请输入内容",
...@@ -126,7 +132,7 @@ export default { ...@@ -126,7 +132,7 @@ export default {
const editor = this.$refs.editor; const editor = this.$refs.editor;
this.Quill = new Quill(editor, this.options); this.Quill = new Quill(editor, this.options);
// 如果设置了上传地址则自定义图片上传事件 // 如果设置了上传地址则自定义图片上传事件
if (this.type == 'url') { if (this.type == "url") {
let toolbar = this.Quill.getModule("toolbar"); let toolbar = this.Quill.getModule("toolbar");
toolbar.addHandler("image", (value) => { toolbar.addHandler("image", (value) => {
this.uploadType = "image"; this.uploadType = "image";
...@@ -191,7 +197,8 @@ export default { ...@@ -191,7 +197,8 @@ export default {
</script> </script>
<style> <style>
.editor, .ql-toolbar { .editor,
.ql-toolbar {
white-space: pre-wrap !important; white-space: pre-wrap !important;
line-height: normal !important; line-height: normal !important;
} }
......
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