Ueditor自定义按钮

集成vue-ueditor-wrap第三方组件,对作者给出来的自定义按钮做了一个简化。
首先加一个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) => { 
				 //点击按钮后的动作在这里定义
			}
		});
	}
})

end!!!

发布了24 篇原创文章 · 获赞 11 · 访问量 5400

猜你喜欢

转载自blog.csdn.net/weixin_44037376/article/details/101285531