UNPKG

winbox-ui-next

Version:

We Design Vue 2.0: A Vue.js 3 UI Library

40 lines (39 loc) 1.15 kB
import { defineComponent, createVNode } from "vue"; import { getPrefixCls } from "../_utils/global-config.js"; var _Divider = defineComponent({ name: "Divider", props: { direction: { type: String, validator: (value) => ["horizontal", "vertical"].includes(value), default: "horizontal" }, contentPosition: { type: String, validator: (value) => ["left", "right", "center"].includes(value), default: "center" } }, setup(props, { slots }) { const prefixCls = getPrefixCls("divider"); return () => { var _a; const { direction, contentPosition } = props; const children = (_a = slots.default) == null ? void 0 : _a.call(slots); const classNames = [prefixCls, `${prefixCls}-${direction}`, { [`${prefixCls}-with-text`]: children }]; return createVNode("div", { "class": classNames }, [children && direction === "horizontal" ? createVNode("span", { "class": `${prefixCls}-text ${prefixCls}-text-${contentPosition}` }, [children]) : null]); }; } }); export { _Divider as default };