Table of contents
need:
Modify the default label style of the el-tab tab page (as shown in the picture, the font of the label label is smaller, so that it is not obvious on the page, I want to modify its style)
Illustration:
Modification method:
Original code:
<el-tab-pane label="全部" name="first"> </el-tab-pane> <el-tab-pane label="计算机科学" name="second"> </el-tab-pane> <el-tab-pane label="土木工程" name="third"> </el-tab-pane>
Modify the code:
<el-tab-pane name="first"> <template #label> <div style="font-weight: 600; color: rgb(95, 91, 91);"> 全部 </div> </template> </el-tab-pane> <el-tab-pane name="second"> <template #label> <div style="font-weight: 600; color: rgb(95, 91, 91);"> 计算机科学 </div> </template> </el-tab-pane> <el-tab-pane name="third"> <template #label> <div style="font-weight: 600; color: rgb(95, 91, 91);"> 土木工程 </div> </template> </el-tab-pane>
Specific steps:
- Use slot: #label
- Label must be placed with template tag
- But using css style in template will not work
- So add the div tag to the template
- Use css styles in div tags