UNPKG

fast-vue3-ui

Version:

<h1 align="center"> fast-ui </h1>

67 lines (66 loc) 1.96 kB
import { defineComponent as d, ref as u, openBlock as l, createElementBlock as s, withDirectives as g, createElementVNode as i, vShow as h, renderSlot as F, createBlock as y, Fragment as L, renderList as B, toDisplayString as C, createVNode as I } from "vue"; import "./style/index.css"; import S from "../icon/icon.mjs"; import $ from "./dragger.mjs"; const b = { class: "k-upload" }, w = ["multiple", "accept"], D = { class: "k-upload-list" }, E = { class: "k-upload-list_item-name" }, N = { class: "k-upload-list_item-status-label" }, U = d({ name: "k-upload" }), x = d({ ...U, props: { multiple: { type: Boolean }, accept: null, drag: { type: Boolean } }, emits: ["getFilesList"], setup(m, { emit: o }) { const a = m, c = u(), t = u([]), r = () => { c.value.click(); }, _ = (e) => { const n = e.target.files; !n || (t.value.push(...Array.from(n)), o("getFilesList", t.value)); }, f = (e) => { t.value.splice(e, 1), o("getFilesList", t.value); }, k = (e) => { t.value = e, o("getFilesList", e); }; return (e, n) => (l(), s("div", b, [ g(i("input", { type: "file", multiple: a.multiple, accept: a.accept, ref_key: "kIpt", ref: c, onChange: _ }, null, 40, w), [ [h, !1] ]), a.drag ? (l(), y($, { key: 1, onGetFilesList: k, onFileUpload: r })) : (l(), s("div", { key: 0, onClick: r }, [ F(e.$slots, "default") ])), i("div", D, [ (l(!0), s(L, null, B(t.value, (v, p) => (l(), s("div", { class: "k-upload-list_item", key: p }, [ i("div", E, C(v.name), 1), i("div", N, [ I(S, { name: "ashbin", onClick: (V) => f(p) }, null, 8, ["onClick"]) ]) ]))), 128)) ]) ])); } }); export { x as default };