UNPKG

element-plus

Version:

A Component Library for Vue3.0

60 lines (56 loc) 1.6 kB
import { defineComponent, provide, computed, h } from 'vue'; var Row = defineComponent({ name: 'ElRow', props: { tag: { type: String, default: 'div', }, gutter: { type: Number, default: 0, }, type: { type: String, default: '', }, justify: { type: String, default: 'start', }, align: { type: String, default: 'top', }, }, setup(props, { slots }) { provide('ElRow', props.gutter); const style = computed(() => { const ret = { marginLeft: '', marginRight: '', }; if (props.gutter) { ret.marginLeft = `-${props.gutter / 2}px`; ret.marginRight = ret.marginLeft; } return ret; }); return () => { var _a; return h(props.tag, { class: [ 'el-row', props.justify !== 'start' ? `is-justify-${props.justify}` : '', props.align !== 'top' ? `is-align-${props.align}` : '', props.type === 'flex' ? 'el-row--flex' : '', ], style: style.value, }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); }; }, }); Row.install = (app) => { app.component(Row.name, Row); }; export default Row;