Display Vuetify tooltip on disabled button

后端 未结 2 408
长发绾君心
长发绾君心 2021-01-07 23:26

I am having difficulty displaying a tooltip on a button that is disabled with Vuetify.

I\'ve made sure the tooltip can be displayed when the button is enabled, this

相关标签:
2条回答
  • 2021-01-08 00:07

    Not sure if this is the absolute best way but I was able to get a tooltip on a disabled button by wrapping it in a div tag:

    Codepen

    <v-tooltip v-model="show" top>
      <template v-slot:activator="{ on }">
        <div v-on="on">
          <v-btn disabled icon>
            <v-icon color="grey lighten-1">shopping_cart</v-icon>
          </v-btn>
        </div>
      </template>
      <span>Programmatic tooltip</span>
    </v-tooltip>
    
    0 讨论(0)
  • 2021-01-08 00:13

    As vuetify tooltip evolved to the slot syntax the right solution ist now this one:

    <v-tooltip bottom :disabled="valid">
        <template v-slot:activator="{ on }">
        <div v-on="on" class="d-inline-block">
            <v-btn color="primary" :disabled="!valid">Button</v-btn>
        </div>
        </template>
        <span>You must accept first</span>
    </v-tooltip>
    
    0 讨论(0)
提交回复
热议问题