How do I enable tooltips on a disabled text-field in vuetify?

拟墨画扇 提交于 2020-01-23 03:48:46

问题


The code shows the tooltip icon but does not show anything when I hover on it.How do I enable it on hover like in the case of number below.

https://vuetifyjs.com/en/components/tooltips

<v-text-field label="Name" id="name" disabled>
    <v-tooltip slot="append" :value="true" bottom>
        <v-icon slot="activator" color="primary" dark>live_help</v-icon>
        <span>Name of the user</span>
    </v-tooltip>
</v-text-field>

<v-text-field label="number" id="number">
     <v-tooltip slot="append" bottom>
          <v-icon slot="activator" color="primary" dark>live_help</v-icon>
          <span> Number of years</span>
     </v-tooltip>
</v-text-field>

回答1:


Vuetify disables all pointer events for disabled input fields:

.v-input--is-disabled:not(.v-input--is-readonly) {
    pointer-events: none;
}

Two ways to remove this:

  1. You add a custom class to this input where you say pointer-events: auto or
  2. You pass the readonly prop to the component so that Vuetify adds v-input--is-readonly class which removes the pointer-events: none condition automatically.

So, your input definition becomes:

<v-text-field label="Name" id="name" disabled readonly>
    <v-tooltip slot="append" :value="true" bottom>
        <v-icon slot="activator" color="primary" dark>live_help</v-icon>
        <span>Name of the user</span>
    </v-tooltip>
</v-text-field>


来源:https://stackoverflow.com/questions/51826891/how-do-i-enable-tooltips-on-a-disabled-text-field-in-vuetify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!