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.

31 lines (30 loc) 1.01 kB
import "../chunk-G2ADBYYC.js"; import { computedLineStyle, computedTextStyle, computedRootStyle, setDividerHeight } from "./index"; const api = ["state"]; const renderless = (props, { reactive, onMounted, computed }, { vm, nextTick }) => { const defaultMargin = "16px 0"; const verticalMargin = "0 8px"; const api2 = {}; const state = reactive({ height: "auto", margin: props.direction === "vertical" ? verticalMargin : defaultMargin, lineStyle: computed(() => api2.computedLineStyle()), textStyle: computed(() => api2.computedTextStyle()), rootStyle: computed(() => api2.computedRootStyle()) }); Object.assign(api2, { state, computedLineStyle: computedLineStyle({ props }), computedTextStyle: computedTextStyle({ props }), computedRootStyle: computedRootStyle({ props, state }), setDividerHeight: setDividerHeight({ props, state, vm, nextTick }) }); onMounted(() => { api2.setDividerHeight(); }); return api2; }; export { api, renderless };