@fesjs/fes-design
Version:
fes-design for PC
51 lines (47 loc) • 2.44 kB
JavaScript
import { defineComponent, inject, openBlock, createElementBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, renderSlot, createVNode, toDisplayString, normalizeStyle, createCommentVNode, createBlock } from 'vue';
import CloseCircleFilled from '../icon/CloseCircleFilled';
import FileOutlined from '../icon/FileOutlined';
import { key } from './const';
var script = /*@__PURE__*/defineComponent({
__name: 'fileList',
setup(__props) {
const {
disabled,
prefixCls,
uploadFiles,
onRemove
} = inject(key);
return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", {
class: normalizeClass(`${unref(prefixCls)}-list`)
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(uploadFiles), file => {
return openBlock(), createElementBlock("div", {
key: file.uid,
class: normalizeClass([`${unref(prefixCls)}-list-item`, `is-${file.status}`])
}, [createElementVNode("div", {
class: normalizeClass(`${unref(prefixCls)}-list-name-wrapper`)
}, [renderSlot(_ctx.$slots, "file", {
file: file
}, () => [createVNode(unref(FileOutlined)), createElementVNode("div", {
class: normalizeClass(`${unref(prefixCls)}-list-name`)
}, toDisplayString(file.name), 3 /* TEXT, CLASS */)]), file.status === 'uploading' ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass(`${unref(prefixCls)}-list-progress`)
}, [createElementVNode("span", {
class: normalizeClass(`${unref(prefixCls)}-list-progress-inner`),
style: normalizeStyle({
width: `${file.percentage}%`
})
}, null, 6 /* CLASS, STYLE */)], 2 /* CLASS */)) : createCommentVNode("v-if", true)], 2 /* CLASS */), createElementVNode("div", {
class: normalizeClass(`${unref(prefixCls)}-list-icons`)
}, [!unref(disabled) ? (openBlock(), createBlock(unref(CloseCircleFilled), {
key: 0,
class: normalizeClass(`${unref(prefixCls)}-list-icons-close`),
onClick: $event => unref(onRemove)(null, file)
}, null, 8 /* PROPS */, ["class", "onClick"])) : createCommentVNode("v-if", true)], 2 /* CLASS */)], 2 /* CLASS */);
}), 128 /* KEYED_FRAGMENT */))], 2 /* CLASS */);
};
}
});
script.__file = "components/upload/fileList.vue";
export { script as default };