<template>
  <el-tabs v-model="carouselTypeSelected" :stretch="false" @tab-change="handleClick">
    <el-tab-pane name="-1">
      <template #label>
        <div class="cat-tab active">
          <span>全部</span>
        </div>
      </template>
    </el-tab-pane>
    <el-tab-pane v-for="(item, index) in carouselType" :label="item.dictLabel" :name="index">
      <template #label>
        <div class="cat-tab">
          <span>{{ item.dictLabel }}</span>
        </div>
      </template>
    </el-tab-pane>
  </el-tabs>
</template>
<style scoped>
.cat-tab {
  min-width: 100px;
  font-size: 14px;
  font-weight: bold;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cat-tab.active {
  color: blue;
  text-decoration: underline;
}
</style>
<p>在上面的代码中,我给选中的“全部”标签添加了一个名为“active”的类,并在样式中定义了这个类的样式,其中包括蓝色的字体颜色和下划线。这样,无论选择哪个分页标签,只要将<code>cat-tab</code> div的<code>active</code>类添加到选中的标签上,就会应用相同的样式。</p>
<p>请注意,您可能需要调整样式以适应您的具体需求,并根据需要添加其他样式。</p>
Element UI Tabs 样式修改:让所有分页标签都像“全部”一样

原文地址: https://www.cveoy.top/t/topic/pahg 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录