wintercounter / Protip

A new generation jQuery Tooltip plugin
http://protip.rocks
MIT License
359 stars 38 forks source link

reactive text #46

Open nincorada opened 4 years ago

nincorada commented 4 years ago

How can i make the displayed text reactive? I am using this with vue and vue-i18n, a translator. I am passing the data from computed into :data-pt-title="sTooltip" and sTooltip is in the computed object that returns this.$i18n.t('path-to-text')

wintercounter commented 4 years ago

You can try to add data-pt-observer="true". This will watch for attribute changes also.

nincorada commented 4 years ago

the page freezed when i added that attribute

wintercounter commented 4 years ago

I never used Vue with jQuery, but I'm pretty sure it's an anti-pattern in general. I think you'll need to force a rerender or something, so the old tooltip element will be removed, and a new will be added.

Alternatively you can also set it manually using $(el).protipSet({ title: 'My title' }).