Tooltip add maxWidth prop
This commit is contained in:
parent
16e850535b
commit
6b498dd1a4
3 changed files with 27 additions and 4 deletions
|
@ -14,7 +14,7 @@
|
|||
v-transfer-dom>
|
||||
<div :class="[prefixCls + '-content']">
|
||||
<div :class="[prefixCls + '-arrow']"></div>
|
||||
<div :class="[prefixCls + '-inner']"><slot name="content">{{ content }}</slot></div>
|
||||
<div :class="innerClasses" :style="innerStyles"><slot name="content">{{ content }}</slot></div>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
|
@ -67,6 +67,9 @@
|
|||
return oneOf(value, ['dark', 'light']);
|
||||
},
|
||||
default: 'dark'
|
||||
},
|
||||
maxWidth: {
|
||||
type: Number
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
@ -74,6 +77,21 @@
|
|||
prefixCls: prefixCls
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
innerStyles () {
|
||||
const styles = {};
|
||||
if (this.maxWidth) styles['max-width'] = `${this.maxWidth}px`;
|
||||
return styles;
|
||||
},
|
||||
innerClasses () {
|
||||
return [
|
||||
`${prefixCls}-inner`,
|
||||
{
|
||||
[`${prefixCls}-inner-with-width`]: !!this.maxWidth
|
||||
}
|
||||
];
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
content () {
|
||||
this.updatePopper();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue