const template=`
请上传图片
`; import {rand} from '../util.js'; export default { name: "UploadImg", data: function () { return { uuid:'' } }, created:function (){ this.uuid='upload-file-'+rand(1000,9999); }, emits:['change'], props:{ imageUrl:{ type: String }, disabled:{ type: Boolean, default: false }, width:{ type: Number, default: 150 }, height:{ type: Number, default: 150 }, isCircle:{ type: Boolean, default: false }, field:{ type:String, default:'' } }, template:template, methods:{ showImg:function (){ Yunqi.api.previewImg([this.imageUrl]); }, editImg:function (){ let str=`#${this.uuid} .el-upload__input`; let dom = document.querySelector(str); dom && dom.click(); }, deleteImg:function (){ if(this.field){ this.$emit('change',{field:this.field,value:''}); }else{ this.$emit('change',''); } }, fileUploadSuccess:function (e,f){ if(this.field){ this.$emit('change',{field:this.field,value:e.data.fullurl}); }else{ this.$emit('change',e.data.fullurl); } }, } };