Skip to content

Commit 0d8b19e

Browse files
committed
refactor: re-enable ts & improve perf
1 parent eeeb1cf commit 0d8b19e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/directives/BTooltip.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/ban-ts-comment */
21
import {Directive, DirectiveBinding} from 'vue'
32
import Tooltip from 'bootstrap/js/dist/tooltip'
43

@@ -75,15 +74,12 @@ const BTooltip: Directive<HTMLElement> = {
7574
},
7675
updated(el) {
7776
const title = el.getAttribute('title')
78-
const originalTitle = el.getAttribute('data-bs-original-title')
79-
const instance = Tooltip.getInstance(el)
80-
81-
el.removeAttribute('title')
8277

83-
if (title && title !== originalTitle) {
84-
// @ts-ignore
78+
if (title) {
79+
const instance = Tooltip.getInstance(el)
8580
instance?.setContent({'.tooltip-inner': title})
8681
el.setAttribute('data-bs-original-title', title)
82+
el.removeAttribute('title')
8783
}
8884
},
8985
unmounted(el) {

0 commit comments

Comments
 (0)