element-plus/packages/divider/src/index.vue

40 lines
843 B
Vue
Raw Normal View History

2020-07-27 23:22:31 +08:00
<template>
<div :class="['el-divider', `el-divider--${direction}`]">
2020-07-27 23:22:31 +08:00
<div
v-if="$slots.default && direction !== 'vertical'"
:class="['el-divider__text', `is-${contentPosition}`]"
>
<slot></slot>
</div>
</div>
</template>
<script lang="ts">
2020-07-29 20:18:18 +08:00
import { defineComponent } from 'vue'
interface IDividerProps {
direction: string
contentPosition: string
2020-07-29 20:18:18 +08:00
}
export default defineComponent({
2020-07-27 23:22:31 +08:00
name: 'ElDivider',
props: {
direction: {
type: String,
default: 'horizontal',
validator(val: string): boolean {
return ['horizontal', 'vertical'].indexOf(val) !== -1
},
},
contentPosition: {
type: String,
default: 'center',
validator(val: string): boolean {
return ['left', 'center', 'right'].indexOf(val) !== -1
},
},
},
2020-07-29 20:18:18 +08:00
})
2020-07-27 23:22:31 +08:00
</script>