@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.
31 lines (30 loc) • 1.03 kB
JavaScript
import "../chunk-G2ADBYYC.js";
import { getWidth, getMinHeight, getHorizontalWidth, getHorizontalLeft, handleClick, mouseEnter } from "./index";
const api = ["state", "handleClick", "mouseEnter"];
const renderless = (props, { reactive, provide, computed }, { emit }) => {
const state = reactive({
groupSize: props.groupSize,
list: props.list,
width: computed(() => api2.getWidth()),
minHeight: computed(() => api2.getMinHeight()),
horizontalWidth: computed(() => api2.getHorizontalWidth()),
horizontalLeft: computed(() => api2.getHorizontalLeft())
});
const api2 = {
state,
getWidth: getWidth(props),
getMinHeight: getMinHeight(props),
getHorizontalWidth: getHorizontalWidth(props),
getHorizontalLeft: getHorizontalLeft(props),
handleClick: handleClick(emit),
mouseEnter: mouseEnter(emit)
};
provide("groupSize", state.groupSize);
provide("color", props.color);
provide("backgroundColor", props.backgroundColor);
return api2;
};
export {
api,
renderless
};