先上图:
大概就是要个带 标题,图片,文本框 编辑的功能,用的mpvue 写的网上也没找到合适的例子,就自己写了个!
主要代码:
//to详情富文本显示
toDetails(){
this.ifRichText=true
},
//html
<div class="RichText" v-if="ifRichText">
<div class="editor_wrap" >
<div v-for="(item,index) in editList" :key='index'>
<div v-if="item.type=='title'">
<input type="text" class="editInputTitle" placeholder="填写标题" v-model="item.value"/>
<div class="del" @click="editDel(index)">╳</div>
</div>
<div v-if="item.type=='img'">
<div class="editImg" @click.stop="chooseImage(item.number)">
<p class="editImgText" >+添加图片</p>
<div class="editImgAdd">
<div class="weui-uploader__files" id="uploaderFiles" v-if="item.number==0">
<block v-for="(itemImg,index0) in files" :key="index0">
<div class="weui-uploader__file" @click.stop="predivImage($event,item.number)" :id="itemImg">
<image class="weui-uploader__img plan_photo" :src="itemImg" mode="aspectFill" />
</div>
</block>
</div>
<div class="weui-uploader__files" id="uploaderFiles" v-if="item.number==1">
<block v-for="(itemImg,index1) in files1" :key="index1">
<div class="weui-uploader__file" @click.stop="predivImage($event,item.number