song-ui-u
Version:
vue3 + js的PC前端组件库
84 lines (74 loc) • 2.43 kB
JavaScript
'use strict';
var vue = require('vue');
var index$1 = require('../../../hook/use-namespace/index.cjs');
var index = require('../../../hook/use-style/index.cjs');
require('../../../hook/use-zindex/index.cjs');
var _pluginVue_exportHelper = require('../../../_virtual/_plugin-vue_export-helper.cjs');
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 = index$1.useNamespace("row");
const { alignItem, justifyItem } = index.useStyle();
/** props */
const props = __props;
const styleMargin = vue.computed(() => {
const gutter = props.gutter;
const value = gutter ? -gutter / 2 + "px" : null;
return value ? { marginLeft: value, marginRight: value } : {};
});
/**
* 间距
*/
const styleGap = vue.computed(() => {
return props.gap ? { "row-gap": `${props.gap}px` } : {};
});
/**
* 水平对齐
*/
const styleJustifyItem = vue.computed(() => justifyItem(props.justify));
/**
* 垂直对齐
*/
const styleAlignItem = vue.computed(() => alignItem(props.align));
const __returned__ = { ns, alignItem, justifyItem, props, styleMargin, styleGap, styleJustifyItem, styleAlignItem, computed: vue.computed, get useNamespace() { return index$1.useNamespace }, get useStyle() { return index.useStyle } };
Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
return __returned__
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent($props.tag), {
class: vue.normalizeClass([$setup.ns.b()]),
style: vue.normalizeStyle([$setup.styleMargin, $setup.styleGap, $setup.styleJustifyItem, $setup.styleAlignItem])
}, {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "default")
]),
_: 3 /* FORWARDED */
}, 8 /* PROPS */, ["class", "style"]))
}
var Row = /*#__PURE__*/_pluginVue_exportHelper(_sfc_main, [['render',_sfc_render],['__file',"E:\\code\\my-code\\song-ui-ultra\\packages\\components\\row\\src\\index.vue"]]);
module.exports = Row;
//# sourceMappingURL=index.vue.cjs.map