Ueditor custom buttons

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!!!

Published 24 original articles · won praise 11 · views 5400

Guess you like

Origin blog.csdn.net/weixin_44037376/article/details/101285531