Skip to content

Commit e79e88d

Browse files
committed
[Tooltip / Popover] add custom-css prop. (close #292)
1 parent 9df004e commit e79e88d

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

docs/pages/components/Popover.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ Name | Type | Default | Required | Description
195195
`show-delay` | Number | 0 | | (0.30.0+) Delay showing the Popover (ms).
196196
`hide-delay` | Number | 0 | | (0.30.0+) Delay hidding the Popover (ms).
197197
`viewport` | String or Function | | | (0.31.0+) Keeps the popover within the bounds of this element. Example: viewport: '#viewport'. If a function is given, it is called with the triggering element DOM node as its only argument.
198+
`custom-class` | String | | | (0.33.0+) Apply a custom css class to the popover.
198199

199200
### Slots
200201

docs/pages/components/Tooltip.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ Name | Type | Default | Required | Description
161161
`show-delay` | Number | 0 | | (0.30.0+) Delay showing the tooltip (ms).
162162
`hide-delay` | Number | 0 | | (0.30.0+) Delay hidding the tooltip (ms).
163163
`viewport` | String or Function | | | (0.31.0+) Keeps the tooltip within the bounds of this element. Example: viewport: '#viewport'. If a function is given, it is called with the triggering element DOM node as its only argument.
164+
`custom-class` | String | | | (0.33.0+) Apply a custom css class to the tooltip.
164165

165166
### Events
166167

src/directives/popover/popover.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ const bind = (el, binding) => {
1313
appendTo: binding.arg && '#' + binding.arg,
1414
title: binding.value && binding.value.title && binding.value.title.toString(),
1515
content: binding.value && binding.value.content && binding.value.content.toString(),
16-
viewport: binding.value && binding.value.viewport && binding.value.viewport.toString()
16+
viewport: binding.value && binding.value.viewport && binding.value.viewport.toString(),
17+
customClass: binding.value && binding.value.customClass && binding.value.customClass.toString()
1718
}
1819
})
1920
let options = []

src/directives/tooltip/tooltip.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ const bind = (el, binding) => {
1212
target: el,
1313
appendTo: binding.arg && '#' + binding.arg,
1414
text: typeof binding.value === 'string' ? (binding.value && binding.value.toString()) : (binding.value && binding.value.text && binding.value.text.toString()),
15-
viewport: binding.value && binding.value.viewport && binding.value.viewport.toString()
15+
viewport: binding.value && binding.value.viewport && binding.value.viewport.toString(),
16+
customClass: binding.value && binding.value.customClass && binding.value.customClass.toString()
1617
}
1718
})
1819
let options = []

src/mixins/popupMixin.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ export default {
5959
default: true
6060
},
6161
target: null,
62-
viewport: null
62+
viewport: null,
63+
customClass: String
6364
},
6465
data () {
6566
return {
@@ -206,7 +207,7 @@ export default {
206207
this.showTimeoutId = setTimeout(() => {
207208
// add to dom
208209
if (!popUpAppendedContainer) {
209-
popup.className = `${this.name} ${this.placement} fade`
210+
popup.className = `${this.name} ${this.placement} ${this.customClass ? this.customClass : ''} fade`
210211
let container = document.querySelector(this.appendTo)
211212
container.appendChild(popup)
212213
this.resetPosition()

0 commit comments

Comments
 (0)