song-ui-u
Version:
vue3 + js的PC前端组件库
1 lines • 2.37 kB
Source Map (JSON)
{"version":3,"file":"index.vue.cjs","sources":["../../../../../packages/components/row/src/index.vue"],"sourcesContent":["<template>\n <component\n :is=\"tag\"\n :class=\"[ns.b()]\"\n :style=\"[styleMargin, styleGap, styleJustifyItem, styleAlignItem]\"\n >\n <slot />\n </component>\n</template>\n<script>\nexport default { name: \"x-row\" };\n</script>\n<script setup>\nimport { computed } from \"vue\";\nimport { useNamespace, useStyle } from \"@ui-library/hook\";\nconst ns = useNamespace(\"row\");\nconst { alignItem, justifyItem } = useStyle();\n/** props */\nconst props = defineProps({\n tag: {\n type: String,\n default: \"div\",\n },\n gutter: {\n type: Number,\n default: 0,\n },\n justify: {\n type: String,\n default: \"\",\n },\n align: {\n type: String,\n default: \"\",\n },\n gap: {\n type: Number,\n default: 0,\n },\n});\n\nconst styleMargin = computed(() => {\n const gutter = props.gutter;\n const value = gutter ? -gutter / 2 + \"px\" : null;\n return value ? { marginLeft: value, marginRight: value } : {};\n});\n/**\n * 间距\n */\nconst styleGap = computed(() => {\n return props.gap ? { \"row-gap\": `${props.gap}px` } : {};\n});\n/**\n * 水平对齐\n */\nconst styleJustifyItem = computed(() => justifyItem(props.justify));\n/**\n * 垂直对齐\n */\nconst styleAlignItem = computed(() => alignItem(props.align));\n</script>\n"],"names":["useNamespace","useStyle","computed"],"mappings":";;;;;;;;AAUA,MAAA,WAAA,GAAe,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKhC,MAAM,EAAE,GAAGA,oBAAY,CAAC,KAAK,CAAC,CAAA;AAC9B,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAGC,cAAQ,EAAE,CAAA;AAC7C;AACA,MAAM,KAAK,GAAG,OAqBZ,CAAA;;AAEF,MAAM,WAAW,GAAGC,YAAQ,CAAC,MAAM;AACnC,EAAE,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;AAC7B,EAAE,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;AAClD,EAAE,OAAO,KAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;AAC/D,CAAC,CAAC,CAAA;AACF;AACA;AACA;AACA,MAAM,QAAQ,GAAGA,YAAQ,CAAC,MAAM;AAChC,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAA;AACzD,CAAC,CAAC,CAAA;AACF;AACA;AACA;AACA,MAAM,gBAAgB,GAAGA,YAAQ,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;AACnE;AACA;AACA;AACA,MAAM,cAAc,GAAGA,YAAQ,CAAC,MAAM,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;"}