# 编辑器属性
<lay-editor :options="options" :content="content"></lay-editor>
data(){
return {
content:[],
options:{
tools:{},
dialogue:[],
minEmoticon:[],
maxEmoticon:[],
uploadImg:()=>{}
},
}
}
# 工具栏配置
- 默认显示全部
true
显示,false
下隐藏
data(){
return {
options:{
tools:{
title: true, // 标题
text: true, // 文本
code: true, // 代码块
image: true, // 插入图片
link: true, // 链接
dialogue: true, // 对话卡片
extend: true, // 扩展
emoticon: true, // 表情包
fullscreen: true, // 是否全屏
}
},
}
}
# 对话卡片配置
- 表情包仅支持线上图片
data(){
return {
options:{
dialogue:[
{
// 左边人物图片
leftImg:"https://lay-editor.gitee.io/lay-editor-doc/dialogue/hamster-1.png",
// 右边人物图片
rightImg:"https://lay-editor.gitee.io/lay-editor-doc/dialogue/hamster-2.png",
},
]
},
}
}
# 小图表情包配置
- 表情包仅支持线上图片
data(){
return {
options:{
minEmoticon: [
{
title: "百度表情包",
list: [
{
src: "https://s.bdstatic.com/common/openjs/emoticon/img/face_07.png",
},
],
},
],
}
}
}
# 大图表情包配置
- 表情包仅支持线上图片
data(){
return {
options:{
maxEmoticon = [
{
src: "https://lay-editor.gitee.io/lay-editor-doc/maxEmoticon/emoticon-1.jpg",
},
{
src: "https://lay-editor.gitee.io/lay-editor-doc/maxEmoticon/emoticon-2.jpg",
},
{
src: "https://lay-editor.gitee.io/lay-editor-doc/maxEmoticon/emoticon-3.jpg",
},
],
},
}
}
# 编辑器图片上传配置
- 表情包仅支持线上图片
resolve
需要返回上传后的图片路径
data(){
return {
options:{
uploadImg(file, src){
// file 选中的文件 [file格式]
// 文件本地路径
return new Promise((resolve,reject)=>{
// 发送上传图片请求
// src 为上传后的图片地址
resolve(src)
})
}
}
}
}