在Vuetify 2中禁用v-checkbox上的悬停效果。

huangapple go评论73阅读模式
英文:

Disable hover effect on v-checkbox in Vuetify 2

问题

在 Vuetify 2 中悬停在 v-checkbox 上时,复选框后面会出现一个变暗的圆圈。我想让它不出现。目前,我的 v-checkbox 包装在一个 v-tab 和一个 v-tooltip 中。我怀疑这可能不重要,但也有可能重要。

<v-tab v-for="tab in myTabList" :key="tab">
  <span>{{$t(tab)}}</span>
  <v-tooltip bottom>
    <template #activator="{ on }">
      <span v-on="on">
        <v-checkbox @click.stop/>
      </span>
    </template>
    <span>提示文本</span>
  </v-tooltip>
</v-tab>

我尝试将其包装在 v-hover 中并使用禁用属性,但这没有起作用。

英文:

When hovering over a v-checkbox in Vuetify 2, a darkened circle appears behind the checkbox. I would like to make this not appear. Currently, my v-checkbox is wrapped in a v-tab and a v-tooltip. I doubt that matters, but it is possible.

&lt;v-tab v-for=&quot;tab in myTabList&quot; :key=&quot;tab&quot;&gt;
  &lt;span&gt;{{$t(tab)}}&lt;/span&gt;
  &lt;v-tooltip bottom&gt;
    &lt;template #activator=&quot;{ on }&quot;&gt;
      &lt;span v-on=&quot;on&quot;&gt;
        &lt;v-checkbox @click.stop/&gt;
      &lt;/span&gt;
    &lt;/template&gt;
    &lt;span&gt;Tooltip text&lt;/span&gt;
  &lt;/v-tooltip&gt;
&lt;/v-tab&gt;

I tried wrapping it in a v-hover and using the disabled prop, but that didn't work.

答案1

得分: 1

这是涟漪效果,您可以使用 :ripple 属性关闭它:

<v-checkbox
  :ripple="false"
  ...
/>

这是一个示例:

<!-- begin snippet: js hide: true console: false babel: false -->

<!-- language: lang-js -->
new Vue({
  el: '#app',
  vuetify: new Vuetify(),
  data() {
    return {
      myTabList: [1, 2, 3]
    }
  }
})

<!-- language: lang-html -->
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@6.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">

<div id="app">
  <v-app>
    <v-main>
      <v-container>
        <v-tab v-for="tab in myTabList" :key="tab">
          <span>{{tab}}</span>
          <v-tooltip bottom>
            <template #activator="{ on }">
              <span v-on="on">
                <v-checkbox @click.stop :ripple="false"/>
              </span>
            </template>
            <span>Tooltip text</span>
          </v-tooltip>
        </v-tab>
      </v-container>
    </v-main>
  </v-app>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>

<!-- end snippet -->
英文:

That's the ripple effect, you can turn it off using the :ripple prop:

&lt;v-checkbox
  :ripple=&quot;false&quot;
  ...
/&gt;

Here it is in a snippet:

<!-- begin snippet: js hide: true console: false babel: false -->

<!-- language: lang-js -->

new Vue({
  el: &#39;#app&#39;,
  vuetify: new Vuetify(),
  data() {
    return {
      myTabList: [1, 2, 3]
    }
  }
})

<!-- language: lang-html -->

&lt;link href=&quot;https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900&quot; rel=&quot;stylesheet&quot;&gt;
&lt;link href=&quot;https://cdn.jsdelivr.net/npm/@mdi/font@6.x/css/materialdesignicons.min.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;link href=&quot;https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css&quot; rel=&quot;stylesheet&quot;&gt;

&lt;div id=&quot;app&quot;&gt;
  &lt;v-app&gt;
    &lt;v-main&gt;
      &lt;v-container&gt;
        &lt;v-tab v-for=&quot;tab in myTabList&quot; :key=&quot;tab&quot;&gt;
          &lt;span&gt;{{tab}}&lt;/span&gt;
          &lt;v-tooltip bottom&gt;
            &lt;template #activator=&quot;{ on }&quot;&gt;
              &lt;span v-on=&quot;on&quot;&gt;
                &lt;v-checkbox @click.stop :ripple=&quot;false&quot;/&gt;
              &lt;/span&gt;
            &lt;/template&gt;
            &lt;span&gt;Tooltip text&lt;/span&gt;
          &lt;/v-tooltip&gt;
        &lt;/v-tab&gt;
      &lt;/v-container&gt;
    &lt;/v-main&gt;
  &lt;/v-app&gt;
&lt;/div&gt;

&lt;script src=&quot;https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js&quot;&gt;&lt;/script&gt;

<!-- end snippet -->

huangapple
  • 本文由 发表于 2023年7月3日 22:17:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76605620.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定