PlainTabs 普通的标签页 
相比ElTabs,该组件只是一个普通的 tab 切换,不包含延迟渲染,缓存渲染功能,但在外层也可以轻松做到。
基础用法 
传入options选项来渲染 tab 列表,使用v-model来绑定 tab 值
企业素材
个人素材
免费素材
我是内容A
vue
<template>
  <el-plain-tabs v-model="currentTab" :options="tabs">
    <transition mode="out-in" name="el-fade-in-linear">
      <template v-if="currentTab === 'tab1'">
        <div>我是内容A</div>
      </template>
      <template v-else-if="currentTab === 'tab2'">
        <div>我是内容B</div>
      </template>
      <template v-else>
        <div>我是内容C</div>
      </template>
    </transition>
  </el-plain-tabs>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
const currentTab = ref('tab1')
const tabs = ref([
  {
    label: '企业素材',
    value: 'tab1',
  },
  {
    label: '个人素材',
    value: 'tab2',
  },
  {
    label: '免费素材',
    value: 'tab3',
  },
])
</script>
隐藏源代码
卡片风格的标签 
传入type为card来渲染卡片风格
建议配合component组件来使用,这样会使代码变得清晰
商品/营销素材
快捷回复素材
测试啊
我是组件A
vue
<template>
  <el-plain-tabs v-model="currentTab" :options="tabs" type="card">
    <transition mode="out-in" name="el-fade-in-linear">
      <component :is="currentComp" />
    </transition>
  </el-plain-tabs>
</template>
<script lang="ts" setup>
import { computed, h, ref } from 'vue'
const CompA = () => h('div', {}, '我是组件A')
const CompB = () => h('div', {}, '我是组件B')
const CompC = () => h('div', {}, '我是组件C')
const currentTab = ref('tab1')
const tabs = ref([
  {
    label: '商品/营销素材',
    value: 'tab1',
  },
  {
    label: '快捷回复素材',
    value: 'tab2',
  },
  {
    label: '测试啊',
    value: 'tab3',
  },
])
const currentComp = computed(() =>
  currentTab.value === 'tab1'
    ? CompA
    : currentTab.value === 'tab2'
    ? CompB
    : CompC
)
</script>
隐藏源代码
缓存 
配合keep-alive组件来缓存组件实例
标签页1
标签页2
标签页3
vue
<template>
  <el-plain-tabs v-model="currentTab" :options="tabs" type="card">
    <transition mode="out-in" name="el-fade-in-linear">
      <keep-alive>
        <component :is="currentComp" />
      </keep-alive>
    </transition>
  </el-plain-tabs>
</template>
<script lang="ts" setup>
import { computed, defineComponent, h, ref } from 'vue'
import { ElInput } from 'element-plus'
const CompA = defineComponent({
  setup() {
    const input = ref('hi')
    return () =>
      h(ElInput, {
        modelValue: input.value,
        'onUpdate:modelValue': function (val) {
          input.value = val
        },
      })
  },
})
const CompB = defineComponent({
  setup() {
    const input = ref('Summer')
    return () =>
      h(ElInput, {
        type: 'textarea',
        modelValue: input.value,
        'onUpdate:modelValue': function (val) {
          input.value = val
        },
      })
  },
})
const CompC = () => h('div', {}, '我是组件C')
const currentTab = ref('tab2')
const tabs = ref([
  {
    label: '标签页1',
    value: 'tab1',
  },
  {
    label: '标签页2',
    value: 'tab2',
  },
  {
    label: '标签页3',
    value: 'tab3',
  },
])
const currentComp = computed(() =>
  currentTab.value === 'tab1'
    ? CompA
    : currentTab.value === 'tab2'
    ? CompB
    : CompC
)
</script>
隐藏源代码
动画 
默认插槽抛出了action和transitionName2 个属性,方便应用到组件上
用户也可以根据action的值(next:点击当前选中后面的 tab, prev:点击当前选中前面的 tab),使用自定义的动画名称
商品/营销素材
快捷回复素材
测试啊
我是组件A
vue
<template>
  <el-plain-tabs v-model="currentTab" :options="tabs" type="card">
    <template #default="{ transitionName }">
      <transition mode="out-in" :name="transitionName">
        <component :is="currentComp" class="plain-tabs-container" />
      </transition>
    </template>
  </el-plain-tabs>
</template>
<script lang="ts" setup>
import { computed, h, ref } from 'vue'
const CompA = () => h('div', '我是组件A')
const CompB = () => h('div', '我是组件B')
const CompC = () => h('div', '我是组件C')
const currentTab = ref('tab1')
const tabs = ref([
  {
    label: '商品/营销素材',
    value: 'tab1',
  },
  {
    label: '快捷回复素材',
    value: 'tab2',
  },
  {
    label: '测试啊',
    value: 'tab3',
  },
])
const currentComp = computed(() =>
  currentTab.value === 'tab1'
    ? CompA
    : currentTab.value === 'tab2'
    ? CompB
    : CompC
)
</script>
<style lang="scss">
.plain-tabs-container {
  width: 100%;
  height: 200px;
  overflow: auto;
  padding: 16px 12px;
  border: 1px solid var(--el-border-color-light);
}
</style>
隐藏源代码
API 
属性 
| 属性名 | 说明 | 类型 | 默认值 | 
|---|---|---|---|
| model-value | tab 双向绑定的值 | String|Number | - | 
| options | 取消按钮属性设置 | Array | - | 
| type | 确定按钮属性设置 | String | - | 
Slots 
| 事件名 | 说明 | 
|---|---|
| default | 面板内容 | 
| label | 自定义 label | 
| prepend | 前置插槽(只有 card 模式时才生效) | 
| append | 后置插槽(只有 card 模式时才生效) |