UNPKG

element-plus

Version:

A Component Library for Vue 3

1 lines 1.17 kB
{"version":3,"file":"row2.mjs","names":[],"sources":["../../../../../../packages/components/row/src/row.vue"],"sourcesContent":["<template>\n <component :is=\"tag\" :class=\"rowKls\" :style=\"style\">\n <slot />\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, provide } from 'vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rowContextKey } from './constants'\n\nimport type { CSSProperties } from 'vue'\nimport type { RowProps } from './row'\n\ndefineOptions({\n name: 'ElRow',\n})\n\nconst props = withDefaults(defineProps<RowProps>(), {\n tag: 'div',\n gutter: 0,\n justify: 'start',\n})\n\nconst ns = useNamespace('row')\nconst gutter = computed(() => props.gutter)\n\nprovide(rowContextKey, {\n gutter,\n})\n\nconst style = computed(() => {\n const styles: CSSProperties = {}\n if (!props.gutter) {\n return styles\n }\n\n styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`\n return styles\n})\n\nconst rowKls = computed(() => [\n ns.b(),\n ns.is(`justify-${props.justify}`, props.justify !== 'start'),\n ns.is(`align-${props.align}`, !!props.align),\n])\n</script>\n"],"mappings":""}