600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > 小程序editor 富文本编辑器组件

小程序editor 富文本编辑器组件

时间:2021-01-15 19:51:34

相关推荐

小程序editor 富文本编辑器组件

效果:

关于editor 富文本编辑器组件

复制到组件common 里面。json 引用即可

链接:/s/1_QIp28IOVuyVFfKfFZwxKQ

提取码:qzek

小程序富文本编辑器wxml 部分;组件内引用<editorItem bind:Content="getHtml" option="{{option}}" bind:insertImage="insertImage" id="hf_editor"></editorItem>

data 部分html: '',option: {placeholder: '编写文章...',imgUp: false,width: '100%',height: '600rpx',},actions: [{id:1,name: '提交审核',},{id:2,name: '退出保存草稿',},{id:3,name: '取消',},],},

js 部分//富文本编辑器getHtml(e) {//从组件获取值this.html = e.detail.content.htmlconsole.log('提交的富文本', this.html)},insertImage(){//图片上传插入示例wx.chooseImage({count: 1,success: res => {console.log(res);wx.uploadFile({//调用图片上传接口url: 'http://192.168.1.61:3000/upload', filePath: res.tempFilePaths[0],name: 'imgFile',success: res => {var insertImages=res.data.urlconsole.log(insertImages)let imgUrl = JSON.parse(res.data).urlthis.selectComponent('#hf_editor').insertSrc('http://192.168.1.61:3000' + imgUrl);//调用组件insertSrc方法}})}})},

json 引入组件

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。