简体   繁体   English

如何更改 v-tab-item 背景颜色? 验证

[英]how to change v-tab-item background color? VUETIFY

this is the first time i post here.这是我第一次在这里发帖。 I have tried to do this for 2 days but it has been very difficult for me.我已经尝试这样做了 2 天,但这对我来说非常困难。 I am using Vuetify and v-tabs component to show some stuff like this:我正在使用Vuetifyv-tabs组件来显示如下内容:

EXAMPLE例子

As you can see the background's card is black and i want to change it to transparent so the background html which is a linear gradient between blue/purple/black shows...如您所见,背景卡黑色的,我想将其更改为透明,因此背景 html 是蓝色/紫色/黑色之间的线性渐变显示...

I have tried adding background-color: transparent to v-tab-item just like i did above in the v-tab "Material Clase/Material Complementario" but i don't know why it isn't applied to the v-tab-item below我试过添加 background-color: transparentv-tab-item就像我在上面的 v-tab“Material Clase/Material Complementario”中所做的那样,但我不知道为什么它没有应用于v-tab-下面的项目

This is my code:这是我的代码:

<template>
<v-app style="background-color: rgba(30, 30, 30, 0.3);">
  <v-tabs fixed-tabs background-color="transparent" color="green" slider-color="purple">
    <v-tab>Material Clases</v-tab>
      <v-tab-item >
        <div class="mb-5 p-3">
          <h3 class="mb-3">Guias de clases</h3>
          <div class="row">
            <div
              v-for="(item, i) in items"
              :key="i"
              class="col-sm-12 col-md-6 col-lg-4"
            >
              <v-card
                class="mx-auto background-tr borde-claro"
                max-width="1000"
                elevation="15"
                outlined
              >
                <v-list-item three-line >
                  <v-list-item-content>
                    <div class="text-overline mb-4 tx-white">
                      {{ item.title }}
                    </div>
                    <v-list-item-title class="text-h5 mb-1 tx-white">
                      Clase: {{ item.clase }}
                    </v-list-item-title>
                    <v-list-item-subtitle class="tx-white">
                      Descripcion: {{ item.descripcion }}
                    </v-list-item-subtitle>
                  </v-list-item-content>

                  <v-list-item-avatar
                    tile
                    size="50"
                    color="grey"
                  ></v-list-item-avatar>
                </v-list-item>

                <v-card-actions>
                  <v-btn class="tx-white borde-claro centrar" outlined rounded text >
                    Descargar
                  </v-btn>
                </v-card-actions>
              </v-card>
            </div>
          </div>
        </div>
      </v-tab-item>
</v-app>
</template>
      

As you can see i give to v-tabs the background-color to transparent and it works because it shows the background from the root (linear gradient colors) but if i give a background-color transparent to v-tab-item it doesn't work because i keep seeing the BLACK background like the screenshot i uploaded...如您所见,我将v-tabs背景颜色设置为透明,它之所以有效,是因为它显示了根部的背景(线性渐变颜色),但是如果我将背景颜色设置为v-tab-item透明,则它不会无法正常工作,因为我一直看到黑色背景,就像我上传的屏幕截图一样……

Thanks in advance !!提前致谢 !!

in vuetify you can't change the v-tab-item background-color because its possible to change it in v-tab-items element.在 vuetify 中,您无法更改 v-tab-item 背景颜色,因为可以在 v-tab-items 元素中更改它。 This is what I did:这就是我所做的:

    <v-tabs v-model="userProfileTabs" :show-arrows="false" color="#E30E4F" background-color="transparent" dark>
        <v-tab to="#tabs-1"><b>TAB 1</b></v-tab>
        <v-tab to="#tabs-2"><b>TAB 2</b></v-tab>
    </v-tabs>
    <v-tabs-items v-model="userProfileTabs" id="custom-tab-items">
        <v-tab-item value="tabs-1">
        </v-tab-item>
        <v-tab-item value="tabs-2">
        </v-tab-item>
    </v-tabs-items>

I assigned and id value "custom-tab-items" to the element.我为元素分配了 id 值“custom-tab-items”。 Then, I customize the background color with css:然后,我用 css 自定义背景颜色:

<style>
#custom-tab-items {
    background-color: transparent !important;
}
</style>

use this style for dark and light theme to change all style of v-tabs:将此样式用于深色和浅色主题以更改所有 v-tabs 样式:

.theme--dark.v-tabs-items {
  background-color: transparent !important;
}
.theme--light.v-tabs-items {
  background-color: transparent !important;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM