UNPKG

@opensig/opendesign

Version:

<p align="center"><img src="../docs/public/opendesign-logo-light.png"/></p> <h1 align="center">opendesign</h1> <p align="center">一个 Vue 3 组件库</p> <p align="center"><b>皮肤可定制,使用 TypeScript</b></p>

66 lines (65 loc) 1.86 kB
"use strict"; const vue = require("vue"); const _hoisted_1 = { class: "o-upload-select-input" }; const _hoisted_2 = ["accept", "disabled"]; const _hoisted_3 = ["accept", "disabled"]; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ __name: "InputSelect", props: { accept: {}, disabled: { type: Boolean } }, emits: ["selected"], setup(__props, { expose: __expose, emit: __emit }) { const props = __props; const emits = __emit; const inputRef = vue.ref(null); const multipleInputRef = vue.ref(null); const onInputChange = function(e) { const target = e.target; const files = target.files; if (files && files.length > 0) { emits("selected", files); } target.value = ""; }; const select = (multiple) => { var _a, _b; if (props.disabled) { return; } if (multiple) { (_a = multipleInputRef.value) == null ? void 0 : _a.click(); } else { (_b = inputRef.value) == null ? void 0 : _b.click(); } }; __expose({ select }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ vue.createElementVNode("input", { ref_key: "multipleInputRef", ref: multipleInputRef, type: "file", class: "o-upload-input", multiple: "", accept: props.accept, disabled: props.disabled, onChange: onInputChange }, null, 40, _hoisted_2), vue.createElementVNode("input", { ref_key: "inputRef", ref: inputRef, type: "file", class: "o-upload-input", accept: props.accept, disabled: props.disabled, onChange: onInputChange }, null, 40, _hoisted_3) ]); }; } }); module.exports = _sfc_main;