当前位置: 首页 > news >正文

谷歌镜像网站怎么做个人养老金制度相关细则

谷歌镜像网站怎么做,个人养老金制度相关细则,富阳市建设局网站,西宁百度推广公司电话前言 在使用第三方组件时,有时候组件提供的默认样式不满足我们的实际需求,需要对默认样式进行调整,这就需要用到样式穿透。本篇文章以vue3使用element-ui的Tabs组件,对Tabs组件的添加按钮样式进行客制化为例。 确定需要修改的组…

前言

在使用第三方组件时,有时候组件提供的默认样式不满足我们的实际需求,需要对默认样式进行调整,这就需要用到样式穿透。本篇文章以vue3使用element-ui的Tabs组件,对Tabs组件的添加按钮样式进行客制化为例。

确定需要修改的组件

组件代码

<template><el-tabsv-model="editableTabsValue"type="card"class="demo-tabs"editable@edit="handleTabsEdit"><template #add-icon><el-icon><Select/></el-icon></template><el-tab-panev-for="item in editableTabs":key="item.name":label="item.title":name="item.name">{{ item.content }}</el-tab-pane></el-tabs></template>

预览&确认修改目标

例如修改新闻标签下Tabs组件的添加按钮样式,计划将边框范围扩大、边框调整成圆形、√图标扩大
在这里插入图片描述

新建div以及自定义class

新建一个div,将el-tabs组件包住,并声明一个语义清晰的自定义class name,此处以new-tabs为例

<template><div class="new-tabs"><el-tabsv-model="editableTabsValue"type="card"class="demo-tabs"editable@edit="handleTabsEdit"><template #add-icon><el-icon><Select/></el-icon></template><el-tab-panev-for="item in editableTabs":key="item.name":label="item.title":name="item.name">{{ item.content }}</el-tab-pane></el-tabs></div>
</template>

在浏览器调整样式

定位需要调整的组件

在浏览器打开开发者模式,开启元素检查模式
在这里插入图片描述
定位需要调整的添加按钮,关注离选择元素最接近的class,此处为el-tabs__new-tab,我们可以在右侧观察到el-tabs__new-tab中需要调整的样式,以及刚才新增的自定义样式new-tabs
在这里插入图片描述

在浏览器中调整&预览样式

关注右侧el-tabs__new-tab的样式,我们需要边框范围扩大、边框调整成圆形、√图标扩大。于是将heightwidth从20px调整为30px,border-radius调整成15px,font-size调整成16px

在这里插入图片描述
此时,我们只对样式进行了临时修改,刷新页面后会恢复原状,还需要对css代码进行调整,见下文

整理&修改样式穿透css

上文在浏览器中对el-tabs__new-tab的修改整理如下

.el-tabs__new-tab {height: 30px;width: 30px;border-radius: 15px;font-size: 16px;
}

<style scoped>中申明样式穿透(scoped能够限制自定义样式只会影响当前页面),以我们自定义的classnew-tabs开头,使用:deep()(vue3推荐),参数为上文定位的el-tabs__new-tab

<style scoped>
/* 新闻 */
.new-tabs :deep(.el-tabs__new-tab){height: 30px;width: 30px;border-radius: 15px;font-size: 16px;
}
</style>

确认修改效果

刷新,观察页面渲染,定位到按钮后,观察样式,可知道自定义样式生效,成功覆盖了默认样式
在这里插入图片描述

页面完整代码

<template><div class="new-tabs"><el-tabsv-model="editableTabsValue"type="card"class="demo-tabs"editable@edit="handleTabsEdit"><template #add-icon><el-icon><Select/></el-icon></template><el-tab-panev-for="item in editableTabs":key="item.name":label="item.title":name="item.name">{{ item.content }}</el-tab-pane></el-tabs></div>
</template><script setup lang="ts" name="News">
import axios from "axios";
import { ref } from 'vue'
import { Select } from '@element-plus/icons-vue'
import type { TabPaneName } from 'element-plus'
let tabIndex = 2
const editableTabsValue = ref('2')
const editableTabs = ref([{title: 'Tab 1',name: '1',content: 'Tab 1 news content',},{title: 'Tab 2',name: '2',content: 'Tab 2 news content',},
])const handleTabsEdit = (targetName: TabPaneName | undefined,action: 'remove' | 'add'
) => {if (action === 'add') {const newTabName = `${++tabIndex}`editableTabs.value.push({title: 'New Tab',name: newTabName,content: 'New Tab content',})editableTabsValue.value = newTabName} else if (action === 'remove') {const tabs = editableTabs.valuelet activeName = editableTabsValue.valueif (activeName === targetName) {tabs.forEach((tab, index) => {if (tab.name === targetName) {const nextTab = tabs[index + 1] || tabs[index - 1]if (nextTab) {activeName = nextTab.name}}})}editableTabsValue.value = activeNameeditableTabs.value = tabs.filter((tab) => tab.name !== targetName)}
}
</script><style scoped>
/* 新闻 */
.new-tabs :deep(.el-tabs__new-tab){height: 30px;width: 30px;border-radius: 15px;font-size: 16px;
}
</style>
http://www.dtcms.com/a/542318.html

相关文章:

  • 数据结构——三十一、最小生成树(王道408)
  • MySQL | Windows中mysql的卸载
  • 学前端什么网站好松滋市住房和城乡建设局网站
  • 国际网站排名查询seo运营推广
  • springboot接入企业微信群机器人消息推送
  • 杭州做绒毛鉴定网站wordpress怎么添加导航分类
  • 建设企业网站怎么样公司注册资金500万实缴多少
  • 成都做网站建设公司hdsyscms企业建站系统
  • esp32学习随笔文档1
  • 化妆品网站设计开题报告整站优化快速排名
  • 高端网站建设好的公司设计网站app
  • LLM和智能体的区别
  • End-To-End之于推荐-快手OneRec系列三(OneRec-Think)
  • 做游戏模板下载网站有哪些网站建设策划稿
  • 《投资-143》如何实现“过去思维”向“未来思维”的转变?
  • 做网站的开发软件企业网站 备案 网站名称
  • 企业网站seo实四川建筑培训考试网
  • 石家庄哪里做微网站宁夏自治区住房与城乡建设厅网站
  • 把文件删除了怎么恢复,8个文件恢复方案找回误删除的文件
  • 做会计题目的网站酒店网站建设哪家好
  • 响应式mvc企业网站源码苏州高端网站设计机构
  • java面试-0312-ThreadLocal理解?场景?原理?
  • Go与Python在AI大模型开发中的深度对比分析
  • 大丰哪家专业做网站重庆云阳网站建设
  • BETAFLIGHT固件如何更改陀螺仪引脚适配自己画的板子,带有教程实例
  • QtQuick3D入门(6):3D粒子系统
  • MySQL窗口函数精髓:ROW_NUMBER()详解与实战指南
  • css优先级、继承、经典问题
  • 江门市智企互联网站建设四川省建设厅网站填报获奖
  • 网站营销方案软件工程师培训学校