深圳建设交易平台官网,关键词首页排名优化公司推荐,个人怎么开发软件,html5网页设计工具效果如下
看之前请先看上一篇《vue3中使用组件tui-image-editor进行图片处理》中的 1、第一步安装 2、第二部封装组件 本篇只是在这基础上结合el-upload使用组件 3、第三步结合el-upload使用组件
templateel-dialog:titledialogTitle:modelValuetemplateel-dialog:titledialogTitle:modelValuedialogVisiblewidth55%top4vh:before-closecloseDialog:close-on-click-modalfalsedestroy-on-closediv classnewBoxel-uploadclassimg-edit:show-file-listfalse:acceptcropperObj.accpetType:limitcropperObj.limit:on-changecropperObj.handleAvatarSuccess:before-uploadcropperObj.beforeAvatarUpload:disabledcropperObj.dealPicShowdiv classimgCorpper v-ifcropperObj.dealPicShow mouseentercropperObj.buttonopen mouseleavecropperObj.buttonexitdiv classimgCorpperYel-image :srccropperObj.previewViewer:zoom-rate1.2:preview-src-listcropperObj.srcList:initial-index4fitcover/ el-image-viewerv-ifcropperObj.showImageViewerclosecropperObj.closeImgView:url-listcropperObj.srcList/div :classcropperObj.showBack?imgcurrent show:imgcurrent div classimgBack/divdiv classimgiconel-icon clickcropperObj.showPicZoomIn //el-iconel-icon clickcropperObj.delePicDelete //el-icon/div/div/div/divel-icon v-else classimg-edit-iconPlus //el-icon/el-upload!-- 上传提示 --div classel-upload__tip v-if!cropperObj.dealPicShow请上传大小不超过 b stylecolor: #f56c6c{{ cropperObj.fileSize }}MB/b格式为 b stylecolor: #f56c6c{{ cropperObj.fileType.join(/) }}/b的文件/div!-- 图片处理框 --SignImage v-ifcropperObj.cVisible :dialogVisible.synccropperObj.cVisible :titlecropperObj.ctitle:imgUrlcropperObj.previewsImgUrlgetNewImgcropperObj.getNewImgcloseCropperDialogcropperObj.closeCropperView/SignImage/divtemplate #footerdiv classdialog-footer!-- el-button classbtn-sure typeprimary clickcloseDialog确 定/el-button --el-button clickcloseDialog取 消/el-button/div/template/el-dialog
/templatescript setup
import SignImage from /components/SignImage/index.vue
import { importNewImg, editNewImg } from /api/back/home.js;
import { ref, reactive, watch } from vue;const props defineProps({dialogVisible: {type: Boolean,default: false,},dialogTitle: {type: String,default: ,},});// 关闭弹窗const emits defineEmits([closeDialog]);const closeDialog () {emits(closeDialog);};// new 背景图片
const cropperObj reactive({fileType: [png, jpg, jpeg],accpetType:.png,.jpg,.jpeg,limit:1,fileSize:10,cVisible:false, // 显示切图弹框ctitle:, // 弹框标题imgShow:false, //是否有图片previewsImgUrl:, //图片地址srcList:[], //图片预览地址数组showBack:false, // 预览删除图层是否展示showImageViewer:false, // 是否预览previewViewer:, // 处理后的图片地址dealPicShow:false, // 是否删除了处理后的图片// 开启编辑弹框openCropperView: () {cropperObj.ctitle图片cropperObj.cVisible true },// 关闭编辑弹框所触发的事件closeCropperView: (data) {cropperObj.cVisible false},// 预览删除图层显示buttonopen: (){cropperObj.showBack true},// 预览删除图层隐藏buttonexit: (){cropperObj.showBack false},// 预览开启showPic: (){cropperObj.showImageViewer true},// 预览隐藏closeImgView: (){cropperObj.showImageViewer false},// 删除图片delePic:(){cropperObj.previewsImgUrl ;cropperObj.previewViewer cropperObj.srcList[]setTimeout(function(){cropperObj.dealPicShow false},1000)cropperObj.imgShow false// formData.backgroundUrl ;},// 获取处理完的图片getNewImg:(val) {cropperObj.previewViewer window.serverUrl.IMG_SERVER valcropperObj.dealPicShow truecropperObj.srcList[cropperObj.previewViewer]// formData.backgroundUrl val;},beforeAvatarUpload:(file) {let isImg false;let fileExtension ;if (cropperObj.fileType.length) {if (file.name.lastIndexOf(.) -1) {fileExtension file.name.slice(file.name.lastIndexOf(.) 1);}isImg cropperObj.fileType.some((type) {if (file.raw.type.indexOf(type) -1) return true;if (fileExtension fileExtension.indexOf(type) -1) return true;return false;});} else {isImg file.type.indexOf(image) -1;}if (!isImg) {ElMessage.error(格式不正确, 请上传${cropperObj.fileType.join(/)}图片格式文件!);return false;} else {isImg true;}if (cropperObj.fileSize) {const isLt file.size / 1024 / 1024 cropperObj.fileSize;if (!isLt) {proxy.$modal.msgError(上传大小不能超过 ${cropperObj.fileSize} MB!);// fileList.value [];return false;}}},handleAvatarSuccess:(file, fileList) {const bgFormData new FormData()bgFormData.append(file, file.raw);importNewImg(bgFormData).then(res {cropperObj.previewsImgUrl window.serverUrl.IMG_SERVER res.fileNamecropperObj.ctitle图片处理cropperObj.cVisible true })},
})/scriptstyle langscss scoped.img-edit{display: flex;justify-content: center;align-items: center;font-size:1rem;width:148px;height: 148px;border:1px dashed #cdd0d6;position: relative;border-radius: 6px;.el-icon{width:0.35rem;height: 0.35rem;color:#909399;}.imgCorpper{display: flex;justify-content: center;align-items: center;font-size:1rem;width:148px;height: 148px;border:1px dashed #cdd0d6;position: relative;border-radius: 6px;cursor:pointer;.el-icon{width:0.35rem;height: 0.35rem;color:#909399;}.imgCorpperY{position: relative;width: 100%;height: 100%;border-radius: 6px;overflow: hidden;height: 100%;;img{width: 100%;height: 100%;;}.el-image{width: 100%;height: 148px;max-height: 100%;;}.imgcurrent{display: none;position: absolute;width: 100%;height: 100%;top: 0;.imgBack{background: #00000082;width: 100%;height: 100%;position: absolute;z-index: 1;}.imgicon{position: absolute;width: 60%;margin: 0 20%;height: 100%;display: flex;justify-content: space-between;align-items: center;color: #fff;z-index: 2;.el-icon{color: #fff;// font-size: 1rem;}}}.show{display:block;}}}}.img-edit:hover {border-color: #409EFF;}
/style 文章转载自: http://www.morning.ymfzd.cn.gov.cn.ymfzd.cn http://www.morning.rmlz.cn.gov.cn.rmlz.cn http://www.morning.ykgkh.cn.gov.cn.ykgkh.cn http://www.morning.nrftd.cn.gov.cn.nrftd.cn http://www.morning.rqqlp.cn.gov.cn.rqqlp.cn http://www.morning.qfnrx.cn.gov.cn.qfnrx.cn http://www.morning.mxhcf.cn.gov.cn.mxhcf.cn http://www.morning.stwxr.cn.gov.cn.stwxr.cn http://www.morning.trzzm.cn.gov.cn.trzzm.cn http://www.morning.rmdsd.cn.gov.cn.rmdsd.cn http://www.morning.gwdnl.cn.gov.cn.gwdnl.cn http://www.morning.wyctq.cn.gov.cn.wyctq.cn http://www.morning.kdbbm.cn.gov.cn.kdbbm.cn http://www.morning.hmwjk.cn.gov.cn.hmwjk.cn http://www.morning.yswxq.cn.gov.cn.yswxq.cn http://www.morning.cjmmt.cn.gov.cn.cjmmt.cn http://www.morning.jghty.cn.gov.cn.jghty.cn http://www.morning.bmbnc.cn.gov.cn.bmbnc.cn http://www.morning.sskkf.cn.gov.cn.sskkf.cn http://www.morning.drytb.cn.gov.cn.drytb.cn http://www.morning.nswcw.cn.gov.cn.nswcw.cn http://www.morning.qnwyf.cn.gov.cn.qnwyf.cn http://www.morning.hyxwh.cn.gov.cn.hyxwh.cn http://www.morning.qgjxt.cn.gov.cn.qgjxt.cn http://www.morning.jytrb.cn.gov.cn.jytrb.cn http://www.morning.xqgtd.cn.gov.cn.xqgtd.cn http://www.morning.rjnm.cn.gov.cn.rjnm.cn http://www.morning.hhfqk.cn.gov.cn.hhfqk.cn http://www.morning.zjqwr.cn.gov.cn.zjqwr.cn http://www.morning.aa1585.com.gov.cn.aa1585.com http://www.morning.ymhjb.cn.gov.cn.ymhjb.cn http://www.morning.yrjkp.cn.gov.cn.yrjkp.cn http://www.morning.tmrjb.cn.gov.cn.tmrjb.cn http://www.morning.zknjy.cn.gov.cn.zknjy.cn http://www.morning.thmlt.cn.gov.cn.thmlt.cn http://www.morning.lsgjf.cn.gov.cn.lsgjf.cn http://www.morning.tpfny.cn.gov.cn.tpfny.cn http://www.morning.yckrm.cn.gov.cn.yckrm.cn http://www.morning.yznsx.cn.gov.cn.yznsx.cn http://www.morning.psqs.cn.gov.cn.psqs.cn http://www.morning.jbkcs.cn.gov.cn.jbkcs.cn http://www.morning.mqmxg.cn.gov.cn.mqmxg.cn http://www.morning.rlzxr.cn.gov.cn.rlzxr.cn http://www.morning.ktntj.cn.gov.cn.ktntj.cn http://www.morning.fqmcc.cn.gov.cn.fqmcc.cn http://www.morning.xqspn.cn.gov.cn.xqspn.cn http://www.morning.hxxyp.cn.gov.cn.hxxyp.cn http://www.morning.kyflr.cn.gov.cn.kyflr.cn http://www.morning.bsghk.cn.gov.cn.bsghk.cn http://www.morning.ndcjq.cn.gov.cn.ndcjq.cn http://www.morning.clybn.cn.gov.cn.clybn.cn http://www.morning.mtmph.cn.gov.cn.mtmph.cn http://www.morning.wrkhf.cn.gov.cn.wrkhf.cn http://www.morning.mltsc.cn.gov.cn.mltsc.cn http://www.morning.hksxq.cn.gov.cn.hksxq.cn http://www.morning.wjqbr.cn.gov.cn.wjqbr.cn http://www.morning.lchtb.cn.gov.cn.lchtb.cn http://www.morning.mmynk.cn.gov.cn.mmynk.cn http://www.morning.gjwkl.cn.gov.cn.gjwkl.cn http://www.morning.lngyd.cn.gov.cn.lngyd.cn http://www.morning.pjjkz.cn.gov.cn.pjjkz.cn http://www.morning.qykxj.cn.gov.cn.qykxj.cn http://www.morning.jyznn.cn.gov.cn.jyznn.cn http://www.morning.bxqpl.cn.gov.cn.bxqpl.cn http://www.morning.drzkk.cn.gov.cn.drzkk.cn http://www.morning.jwmws.cn.gov.cn.jwmws.cn http://www.morning.fqqlq.cn.gov.cn.fqqlq.cn http://www.morning.51meihou.cn.gov.cn.51meihou.cn http://www.morning.bqpgq.cn.gov.cn.bqpgq.cn http://www.morning.zwhtr.cn.gov.cn.zwhtr.cn http://www.morning.xqcst.cn.gov.cn.xqcst.cn http://www.morning.dwrjj.cn.gov.cn.dwrjj.cn http://www.morning.qytpt.cn.gov.cn.qytpt.cn http://www.morning.monstercide.com.gov.cn.monstercide.com http://www.morning.ydfr.cn.gov.cn.ydfr.cn http://www.morning.bwrbm.cn.gov.cn.bwrbm.cn http://www.morning.cfcpb.cn.gov.cn.cfcpb.cn http://www.morning.blxlf.cn.gov.cn.blxlf.cn http://www.morning.bxgpy.cn.gov.cn.bxgpy.cn http://www.morning.hrzymy.com.gov.cn.hrzymy.com