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.

40 lines (39 loc) 1.24 kB
import "../chunk-G2ADBYYC.js"; import { computedMessage, computedStyle, computedFontSize, computedLabel, getInternalValue, handleClick, mouseEnter } from "./index"; const api = ["state", "handleClick", "mouseEnter"]; const renderless = (props, { reactive, computed, inject }, { mode, emit }) => { const groupSize = inject("groupSize", null); const state = reactive({ internalValue: computed(() => api2.getInternalValue()), label: computed(() => api2.computedLabel()), style: computed(() => api2.computedStyle()), message: computed(() => api2.computedMessage()), fontSize: computed(() => api2.computedFontSize()), size: groupSize || props.size, color: inject("color", null) || props.color, backgroundColor: inject("backgroundColor", null) || props.backgroundColor }); const api2 = { state, computedLabel: computedLabel({ state, props }), computedStyle: computedStyle({ state, props }), computedMessage: computedMessage({ props }), computedFontSize: computedFontSize({ props, state, mode }), getInternalValue: getInternalValue({ props }), handleClick: handleClick(emit), mouseEnter: mouseEnter(emit) }; return api2; }; export { api, renderless };