Files
zhibo/node_modules/ele-admin/es/ele-cropper/components/cropper-preview.js
T
xiaoyu 5488f5f0a2 init
2023-05-22 14:07:59 +08:00

106 lines
3.2 KiB
JavaScript

function normalizeComponent(scriptExports, render2, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
if (render2) {
options.render = render2;
options.staticRenderFns = staticRenderFns;
options._compiled = true;
}
if (functionalTemplate) {
options.functional = true;
}
if (scopeId) {
options._scopeId = "data-v-" + scopeId;
}
var hook;
if (moduleIdentifier) {
hook = function(context) {
context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
context = __VUE_SSR_CONTEXT__;
}
if (injectStyles) {
injectStyles.call(this, context);
}
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier);
}
};
options._ssrRegister = hook;
} else if (injectStyles) {
hook = shadowMode ? function() {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
);
} : injectStyles;
}
if (hook) {
if (options.functional) {
options._injectStyles = hook;
var originalRender = options.render;
options.render = function renderWithStyleInjection(h, context) {
hook.call(context);
return originalRender(h, context);
};
} else {
var existing = options.beforeCreate;
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
}
}
return {
exports: scriptExports,
options
};
}
const _sfc_main = {
name: "CropperPreview",
props: {
previewWidth: {
type: Number,
required: true
},
aspectRatio: {
type: Number,
required: true
}
},
methods: {
getPreviews() {
var _a;
return (_a = this.$refs.rootRef) == null ? void 0 : _a.querySelectorAll(".ele-cropper-preview");
}
}
};
var _sfc_render = function render() {
var _vm = this, _c = _vm._self._c;
return _c("div", { ref: "rootRef", staticClass: "ele-cropper-preview-group", style: { width: _vm.previewWidth + 14 + "px" } }, [_c("div", { staticClass: "ele-cropper-preview", style: {
width: _vm.previewWidth + "px",
height: _vm.previewWidth / (_vm.aspectRatio || 1) + "px"
} }), _vm.aspectRatio === 1 ? _c("div", { staticClass: "ele-cropper-preview ele-cropper-preview-circle", style: {
width: _vm.previewWidth + "px",
height: _vm.previewWidth / (_vm.aspectRatio || 1) + "px"
} }) : [_c("div", { staticClass: "ele-cropper-preview", style: {
width: _vm.previewWidth + "px",
height: (_vm.previewWidth / 3 * 2 - 10) / (_vm.aspectRatio || 1) + "px"
} }), _c("div", { staticClass: "ele-cropper-preview", style: {
width: _vm.previewWidth + "px",
height: _vm.previewWidth / 3 / (_vm.aspectRatio || 1) + "px",
marginLeft: "10px"
} })]], 2);
};
var _sfc_staticRenderFns = [];
var __component__ = /* @__PURE__ */ normalizeComponent(
_sfc_main,
_sfc_render,
_sfc_staticRenderFns,
false,
null,
null,
null,
null
);
const cropperPreview = __component__.exports;
export {
cropperPreview as default
};