統合されたVUE-ueditorラップサードパーティ製のコンポーネント、著者は、カスタムボタンを配る簡素化しました。
まず、initメソッドを追加すると、
<vue-ueditor-wrap ref="editor" v-model="msg" :config="myConfig" :init="upload" ></vue-ueditor-wrap>
その後のinitメソッドにカスタムボタンを実装
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) => {
//点击按钮后的动作在这里定义
}
});
}
})
終わり!!!