admin管理员组文章数量:1188851
<button v-tooltip="'text'" :disabled=true>Some button</button>
I need the tooltip
explaining why the button is disabled, but when I do, tooltip
is disabled also.
<button v-tooltip="'text'" :disabled=true>Some button</button>
I need the tooltip
explaining why the button is disabled, but when I do, tooltip
is disabled also.
- github.com/Akryum/v-tooltip/issues/125#issuecomment-419824775 – Derek Pollard Commented Dec 12, 2018 at 18:04
3 Answers
Reset to default 17From this issue on the project:
The point with this is, that it's actually not an issue related to v-tooltip, but a browser-specification. Depending on the browser you use, some might and some other might not emit events for disabled elements. In this case, Firefox seems to emit events for disabled buttons and chrome doesn't.
As a workaround you might wrap the button in a div to be able to use v-tooltip on it.
Example
<div v-tooltip="'text'"><button :disabled=true>Some button</button></div>
I guess you could wrap the button in a span and put the tooltip in the span instead of the button ..
<span v-tooltip="condition && 'text'">
<button :disabled="condition">Some button</button>
</span>
Where condition
is some boolean data property. This will make the tooltip appear when the button is disabled and disable the tooltip when the button is enabled.
Try this:
<div
style="display: inline-block"
v-tooltip="'text'"
>
<button disabled>button</button>
</div>
div element default is display: block
. The tooltip position will be error when the child doesn't suit with 100% width.
本文标签: javascriptvtooltip stops working when element is disabledStack Overflow
版权声明:本文标题:javascript - v-tooltip stops working when element is disabled - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738397881a2084609.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论