117 lines
4.2 KiB
JavaScript
117 lines
4.2 KiB
JavaScript
import Locale from "element-ui/lib/mixins/locale";
|
|
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: "ImageItem",
|
|
mixins: [Locale],
|
|
props: {
|
|
item: Object,
|
|
disabled: Boolean,
|
|
itemStyle: Object
|
|
},
|
|
emits: ["remove", "item-click", "retry"],
|
|
computed: {
|
|
statusText() {
|
|
return {
|
|
uploading: this.t("ele.upload.uploading"),
|
|
exception: this.t("ele.upload.exception")
|
|
}[this.item.status];
|
|
},
|
|
progressVisible() {
|
|
return !!(this.item.status && ["uploading", "exception"].includes(this.item.status));
|
|
}
|
|
},
|
|
methods: {
|
|
onRemove() {
|
|
this.$emit("remove");
|
|
},
|
|
onItemClick() {
|
|
this.$emit("item-click");
|
|
},
|
|
onRetry() {
|
|
this.$emit("retry");
|
|
}
|
|
}
|
|
};
|
|
var _sfc_render = function render() {
|
|
var _vm = this, _c = _vm._self._c;
|
|
return _c("div", { class: ["ele-image-upload-item", { draggable: !_vm.disabled }], style: _vm.itemStyle, on: { "click": _vm.onItemClick } }, [_vm.item.url ? _c("el-image", { attrs: { "fit": "cover", "width": "100%", "height": "100%", "src": _vm.item.url, "title": _vm.item.name } }) : [_vm._t("image", function() {
|
|
return [_c("div", { staticClass: "ele-image-upload-thumbnail", attrs: { "title": _vm.item.name } }, [_c("i", { staticClass: "el-icon-document" })])];
|
|
}, { "item": _vm.item })], !_vm.disabled ? _c("div", { staticClass: "ele-image-upload-close", on: { "click": function($event) {
|
|
$event.stopPropagation();
|
|
return _vm.onRemove.apply(null, arguments);
|
|
} } }, [_c("i", { staticClass: "el-icon-close" })]) : _vm._e(), _vm.progressVisible ? _c("div", { staticClass: "ele-image-upload-progress" }, [_vm._t("progress", function() {
|
|
return [_c("div", { staticClass: "ele-image-upload-text" }, [_vm._v(_vm._s(_vm.statusText))]), _c("el-progress", { attrs: { "show-text": false, "percentage": _vm.item.progress, "status": { exception: "exception" }[_vm.item.status] } }), _vm.item.status === "exception" ? _c("div", { staticClass: "ele-image-upload-retry" }, [_c("i", { staticClass: "el-icon-refresh", attrs: { "title": _vm.t("ele.upload.retry") }, on: { "click": function($event) {
|
|
$event.stopPropagation();
|
|
return _vm.onRetry.apply(null, arguments);
|
|
} } })]) : _vm._e()];
|
|
}, { "item": _vm.item })], 2) : _c("div", { staticClass: "ele-image-upload-mask" })], 2);
|
|
};
|
|
var _sfc_staticRenderFns = [];
|
|
var __component__ = /* @__PURE__ */ normalizeComponent(
|
|
_sfc_main,
|
|
_sfc_render,
|
|
_sfc_staticRenderFns,
|
|
false,
|
|
null,
|
|
null,
|
|
null,
|
|
null
|
|
);
|
|
const imageItem = __component__.exports;
|
|
export {
|
|
imageItem as default
|
|
};
|