Commit a980832f848bc54410e262249bcc2f1a9830c2f4
1 parent
130ed889
Poptip add padding prop
Showing
2 changed files
with
12 additions
and
3 deletions
Show diff stats
examples/routers/tooltip.vue
| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | <Button @click="handleChange">change</Button> |
| 8 | 8 | </Tooltip> |
| 9 | 9 | <Button @click="handleChange">change</Button> |
| 10 | - <Poptip title="Title" transfer width="250" word-wrap content="我的文本超级,无敌,长我的文本超级无敌长我的文本超级无敌长我的文本超级无敌长我的文本超级无敌长我的文本超级无敌长"> | |
| 10 | + <Poptip title="Title" transfer padding="0" width="250" word-wrap content="我的文本超级,无敌,长我的文本超级无敌长我的文本超级无敌长我的文本超级无敌长我的文本超级无敌长我的文本超级无敌长"> | |
| 11 | 11 | <Button>Click</Button> |
| 12 | 12 | </Poptip> |
| 13 | 13 | </div> | ... | ... |
src/components/poptip/poptip.vue
| ... | ... | @@ -36,8 +36,8 @@ |
| 36 | 36 | </div> |
| 37 | 37 | </div> |
| 38 | 38 | <div :class="[prefixCls + '-inner']" v-if="!confirm"> |
| 39 | - <div :class="[prefixCls + '-title']" v-if="showTitle" ref="title"><slot name="title"><div :class="[prefixCls + '-title-inner']">{{ title }}</div></slot></div> | |
| 40 | - <div :class="[prefixCls + '-body']"> | |
| 39 | + <div :class="[prefixCls + '-title']" :style="contentPaddingStyle" v-if="showTitle" ref="title"><slot name="title"><div :class="[prefixCls + '-title-inner']">{{ title }}</div></slot></div> | |
| 40 | + <div :class="[prefixCls + '-body']" :style="contentPaddingStyle"> | |
| 41 | 41 | <div :class="contentClasses"><slot name="content"><div :class="[prefixCls + '-body-content-inner']">{{ content }}</div></slot></div> |
| 42 | 42 | </div> |
| 43 | 43 | </div> |
| ... | ... | @@ -104,6 +104,10 @@ |
| 104 | 104 | wordWrap: { |
| 105 | 105 | type: Boolean, |
| 106 | 106 | default: false |
| 107 | + }, | |
| 108 | + // default by css: 8px 16px | |
| 109 | + padding: { | |
| 110 | + type: String | |
| 107 | 111 | } |
| 108 | 112 | }, |
| 109 | 113 | data () { |
| ... | ... | @@ -161,6 +165,11 @@ |
| 161 | 165 | [`${prefixCls}-body-content-word-wrap`]: this.wordWrap |
| 162 | 166 | } |
| 163 | 167 | ]; |
| 168 | + }, | |
| 169 | + contentPaddingStyle () { | |
| 170 | + const styles = {}; | |
| 171 | + if (!!this.padding) styles['padding'] = this.padding; | |
| 172 | + return styles; | |
| 164 | 173 | } |
| 165 | 174 | }, |
| 166 | 175 | methods: { | ... | ... |