mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-26 12:32:17 +08:00
refactor(components): refactor row
This commit is contained in:
@ -1,13 +1,7 @@
|
|||||||
|
import { withInstall } from '@element-plus/utils/with-install'
|
||||||
import Row from './src/row'
|
import Row from './src/row'
|
||||||
|
|
||||||
import type { App } from 'vue'
|
export const ElRow = withInstall(Row)
|
||||||
import type { SFCWithInstall } from '@element-plus/utils/types'
|
export default ElRow
|
||||||
|
|
||||||
const _Row = Row as SFCWithInstall<typeof Row>
|
export * from './src/row'
|
||||||
|
|
||||||
_Row.install = (app: App) => {
|
|
||||||
app.component(_Row.name, _Row)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default _Row
|
|
||||||
export const ElRow = _Row
|
|
||||||
|
@ -1,25 +1,30 @@
|
|||||||
import { defineComponent, computed, h, provide } from 'vue'
|
import { defineComponent, computed, h, provide } from 'vue'
|
||||||
|
import { buildProps } from '@element-plus/utils/props'
|
||||||
|
import type { ExtractPropTypes } from 'vue'
|
||||||
|
|
||||||
|
export const rowProps = buildProps({
|
||||||
|
tag: {
|
||||||
|
type: String,
|
||||||
|
default: 'div',
|
||||||
|
},
|
||||||
|
gutter: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
justify: {
|
||||||
|
type: String,
|
||||||
|
default: 'start',
|
||||||
|
},
|
||||||
|
align: {
|
||||||
|
type: String,
|
||||||
|
default: 'top',
|
||||||
|
},
|
||||||
|
} as const)
|
||||||
|
export type RowProps = ExtractPropTypes<typeof rowProps>
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'ElRow',
|
name: 'ElRow',
|
||||||
props: {
|
props: rowProps,
|
||||||
tag: {
|
|
||||||
type: String,
|
|
||||||
default: 'div',
|
|
||||||
},
|
|
||||||
gutter: {
|
|
||||||
type: Number,
|
|
||||||
default: 0,
|
|
||||||
},
|
|
||||||
justify: {
|
|
||||||
type: String,
|
|
||||||
default: 'start',
|
|
||||||
},
|
|
||||||
align: {
|
|
||||||
type: String,
|
|
||||||
default: 'top',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
setup(props, { slots }) {
|
setup(props, { slots }) {
|
||||||
const gutter = computed(() => props.gutter)
|
const gutter = computed(() => props.gutter)
|
||||||
provide('ElRow', {
|
provide('ElRow', {
|
||||||
|
Reference in New Issue
Block a user