-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
33 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
:: BASE_DOC :: | ||
|
||
## API | ||
|
||
### Divider Props | ||
|
||
name | type | default | description | required | ||
-- | -- | -- | -- | -- | ||
align | String | center | options:left/right/center | N | ||
content | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N | ||
dashed | Boolean | false | \- | N | ||
default | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/common.ts) | N | ||
layout | String | horizontal | options:horizontal/vertical | N |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,34 @@ | ||
<template> | ||
<div role="separator" :class="{ [`${name}--vertical-center`]: layout === 'vertical' }"> | ||
<div :class="dividerClass" :style="`border-color:${lineColor}`"> | ||
<div :class="`${name}__content`"> | ||
<t-node :content="dividerContent" /> | ||
</div> | ||
<div :class="rootClass" role="separator"> | ||
<div :class="`${name}__content`"> | ||
<t-node :content="dividerContent" /> | ||
</div> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
import { computed, toRefs, defineComponent, getCurrentInstance } from 'vue'; | ||
import { computed, defineProps, getCurrentInstance } from 'vue'; | ||
import { renderContent, TNode } from '../shared'; | ||
import DividerProps from './props'; | ||
import config from '../config'; | ||
const { prefix } = config; | ||
const name = `${prefix}-divider`; | ||
export default defineComponent({ | ||
export default { | ||
name, | ||
components: { TNode }, | ||
props: DividerProps, | ||
setup(props) { | ||
const internalInstance = getCurrentInstance(); | ||
const dividerContent = computed(() => renderContent(internalInstance, 'default', 'content')); | ||
const dividerClass = computed(() => [ | ||
`${name}`, | ||
`${name}--${props.layout}`, | ||
`${name}--${props.align}`, | ||
{ | ||
[`${name}--dashed`]: props.dashed, | ||
}, | ||
]); | ||
}; | ||
</script> | ||
|
||
return { | ||
name, | ||
...toRefs(props), | ||
dividerContent, | ||
dividerClass, | ||
}; | ||
<script lang="ts" setup> | ||
const props = defineProps(DividerProps); | ||
const internalInstance = getCurrentInstance(); | ||
const dividerContent = computed(() => renderContent(internalInstance, 'default', 'content')); | ||
const rootClass = computed(() => [ | ||
`${name}`, | ||
`${name}--${props.layout}`, | ||
`${name}--${props.align}`, | ||
{ | ||
[`${name}--dashed`]: props.dashed, | ||
}, | ||
}); | ||
]); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters