UNPKG

@opentiny/vue-renderless

Version:

An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.

27 lines (26 loc) 699 B
import "../chunk-G2ADBYYC.js"; import { onDragOver, onDrop, watchDragover } from "./index"; const api = ["state", "onDragOver", "onDrop"]; const renderless = (props, { inject, reactive, ref, watch }, { emit }) => { const state = reactive({ dragover: false, uploadFiles: [], uploader: inject("uploader") || ref({ default: "" }) }); const constants = state.uploader.$constants || {}; const api2 = { state, onDragOver: onDragOver({ props, state }), onDrop: onDrop({ emit, props, state }), watchDragover: watchDragover({ state, constants }) }; watch( () => state.dragover, () => api2.watchDragover() ); return api2; }; export { api, renderless };