Integrated vue-ueditor-wrap third-party components, the authors give out a custom button made simplified.
First, add an init method
<vue-ueditor-wrap ref="editor" v-model="msg" :config="myConfig" :init="upload" ></vue-ueditor-wrap>
Then implement a custom button in the init method
this.$refs.editor.registerButton({
name: '图片上传',
icon: '/static/images/uploadImg.png',
tip: '点击上传图片',
handler: (editor, name) => {
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['album'],
success: (res) => {
//点击按钮后的动作在这里定义
}
});
}
})
end!!!