Skip to content

Commit

Permalink
refactor(components): refactor space (element-plus#3757)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz authored Oct 6, 2021
1 parent 23a2ac5 commit 3b9e63d
Show file tree
Hide file tree
Showing 10 changed files with 320 additions and 316 deletions.
2 changes: 1 addition & 1 deletion packages/components/space/__tests__/space.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { nextTick, h } from 'vue'
import { mount } from '@vue/test-utils'
import Space from '../src/index'
import Space from '../src/space'

const AXIOM = 'Rem is the best girl'

Expand Down
16 changes: 6 additions & 10 deletions packages/components/space/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import Space from './src/index'
import { withInstall } from '@element-plus/utils/with-install'

import type { App } from 'vue'
import type { SFCWithInstall } from '@element-plus/utils/types'
import Space from './src/space'

const _Space = Space as SFCWithInstall<typeof Space>
export const ElSpace = withInstall(Space)
export default ElSpace

_Space.install = (app: App) => {
app.component(_Space.name, _Space)
}

export default _Space
export const ElSpace = _Space
export * from './src/space'
export * from './src/use-space'
143 changes: 0 additions & 143 deletions packages/components/space/src/index.ts

This file was deleted.

22 changes: 14 additions & 8 deletions packages/components/space/src/item.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
<template>
<div :class="classes">
<slot></slot>
<slot />
</div>
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue'
import { buildProps } from '@element-plus/utils/props'
export default defineComponent({
props: {
prefixCls: {
type: String,
default: 'el-space',
},
const spaceItem = buildProps({
prefixCls: {
type: String,
default: 'el-space',
},
} as const)
export default defineComponent({
props: spaceItem,
setup(props) {
const classes = computed(() => [`${props.prefixCls}__item`])
return {
classes: computed(() => `${props.prefixCls}__item`),
classes,
}
},
})
Expand Down
Loading

0 comments on commit 3b9e63d

Please sign in to comment.