song-ui-u
Version:
vue3 + js的PC前端组件库
82 lines (73 loc) • 2.42 kB
JavaScript
import { computed, openBlock, createBlock, resolveDynamicComponent, normalizeClass, normalizeStyle, withCtx, renderSlot } from 'vue';
import { useNamespace } from '../../../hook/use-namespace/index.mjs';
import { useStyle } from '../../../hook/use-style/index.mjs';
import '../../../hook/use-zindex/index.mjs';
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
const __default__ = { name: "x-row" };
const _sfc_main = /*#__PURE__*/Object.assign(__default__, {
props: {
tag: {
type: String,
default: "div",
},
gutter: {
type: Number,
default: 0,
},
justify: {
type: String,
default: "",
},
align: {
type: String,
default: "",
},
gap: {
type: Number,
default: 0,
},
},
setup(__props, { expose: __expose }) {
__expose();
const ns = useNamespace("row");
const { alignItem, justifyItem } = useStyle();
/** props */
const props = __props;
const styleMargin = computed(() => {
const gutter = props.gutter;
const value = gutter ? -gutter / 2 + "px" : null;
return value ? { marginLeft: value, marginRight: value } : {};
});
/**
* 间距
*/
const styleGap = computed(() => {
return props.gap ? { "row-gap": `${props.gap}px` } : {};
});
/**
* 水平对齐
*/
const styleJustifyItem = computed(() => justifyItem(props.justify));
/**
* 垂直对齐
*/
const styleAlignItem = computed(() => alignItem(props.align));
const __returned__ = { ns, alignItem, justifyItem, props, styleMargin, styleGap, styleJustifyItem, styleAlignItem, computed, get useNamespace() { return useNamespace }, get useStyle() { return useStyle } };
Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
return __returned__
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return (openBlock(), createBlock(resolveDynamicComponent($props.tag), {
class: normalizeClass([$setup.ns.b()]),
style: normalizeStyle([$setup.styleMargin, $setup.styleGap, $setup.styleJustifyItem, $setup.styleAlignItem])
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["class", "style"]))
}
var Row = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render],['__file',"E:\\code\\my-code\\song-ui-ultra\\packages\\components\\row\\src\\index.vue"]]);
export { Row as default };
//# sourceMappingURL=index.vue.mjs.map