1 line
1.4 KiB
JavaScript
1 line
1.4 KiB
JavaScript
"use strict";(self["webpackChunkX_PHP_Admin"]=self["webpackChunkX_PHP_Admin"]||[]).push([[44],{7044:function(e,t,s){s.r(t),s.d(t,{default:function(){return _}});var r=s(6808);const p=e=>((0,r.dD)("data-v-616a86ed"),e=e(),(0,r.Cn)(),e),i={class:"x-cropper"},a={class:"x-cropper__img"},o=["src"],c={class:"x-cropper__preview"},n=p((()=>(0,r._)("h4",null,"图像预览",-1))),d={class:"x-cropper__preview__img",ref:"preview"};function l(e,t,s,p,l,g){return(0,r.wg)(),(0,r.iD)("div",i,[(0,r._)("div",a,[(0,r._)("img",{src:s.src,ref:"img"},null,8,o)]),(0,r._)("div",c,[n,(0,r._)("div",d,null,512)])])}var g=s(9151),u=s.n(g),m={props:{src:{type:String,default:""},compress:{type:Number,default:1},aspectRatio:{type:Number,default:NaN}},data(){return{crop:null}},watch:{aspectRatio(e){this.crop.setAspectRatio(e)}},mounted(){this.init()},methods:{init(){this.crop=new(u())(this.$refs.img,{viewMode:2,dragMode:"move",responsive:!1,aspectRatio:this.aspectRatio,preview:this.$refs.preview})},setAspectRatio(e){this.crop.setAspectRatio(e)},getCropData(e,t="image/jpeg"){e(this.crop.getCroppedCanvas().toDataURL(t,this.compress))},getCropBlob(e,t="image/jpeg"){this.crop.getCroppedCanvas().toBlob((t=>{e(t)}),t,this.compress)},getCropFile(e,t="fileName.jpg",s="image/jpeg"){this.crop.getCroppedCanvas().toBlob((r=>{let p=new File([r],t,{type:s});e(p)}),s,this.compress)}}},v=s(8700);const h=(0,v.Z)(m,[["render",l],["__scopeId","data-v-616a86ed"]]);var _=h}}]); |