element-plus/packages/divider/src/index.vue
Simona e1add47603
feat(hooks): add useAttrs hook (#317)
* feat(hooks): add useAttrs hook

* feat(hooks): undo binding class and style automatically

* test: remove unused import statement
2020-09-19 20:44:07 +08:00

40 lines
843 B
Vue

<template>
<div :class="['el-divider', `el-divider--${direction}`]">
<div
v-if="$slots.default && direction !== 'vertical'"
:class="['el-divider__text', `is-${contentPosition}`]"
>
<slot></slot>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
interface IDividerProps {
direction: string
contentPosition: string
}
export default defineComponent({
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
},
},
},
})
</script>