x-php-Admin/dist/static/js/44.fe991d71.js

1 line
1.4 KiB
JavaScript
Raw Normal View History

2023-12-25 08:08:40 +00:00
"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 p=s(6808);const r=e=>((0,p.dD)("data-v-616a86ed"),e=e(),(0,p.Cn)(),e),i={class:"x-cropper"},a={class:"x-cropper__img"},o=["src"],c={class:"x-cropper__preview"},n=r((()=>(0,p._)("h4",null,"图像预览",-1))),d={class:"x-cropper__preview__img",ref:"preview"};function l(e,t,s,r,l,g){return(0,p.wg)(),(0,p.iD)("div",i,[(0,p._)("div",a,[(0,p._)("img",{src:s.src,ref:"img"},null,8,o)]),(0,p._)("div",c,[n,(0,p._)("div",d,null,512)])])}var g=s(9151),h=s.n(g),u={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(h())(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((p=>{let r=new File([p],t,{type:s});e(r)}),s,this.compress)}}},m=s(8700);const v=(0,m.Z)(u,[["render",l],["__scopeId","data-v-616a86ed"]]);var _=v}}]);