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

网站建设公司名百度怎么联系客服

网站建设公司名,百度怎么联系客服,网站开发我们都能解决,网站安全管理制度建设目录 一、背景 二、实现思路 方法1:定义全局的CSS变量 方法2:切换已定义好的css文件 方法3:切换顶级CSS类名 (需使用css处理器,如sass、less等) 一、背景 在我们开发中我们会遇到像是需要切换程序风格、主题切换啦这种应用场景。 参考大佬…

目录

一、背景

二、实现思路 

方法1:定义全局的CSS变量

 方法2:切换已定义好的css文件

 方法3:切换顶级CSS类名 (需使用css处理器,如sass、less等)


一、背景

在我们开发中我们会遇到像是需要切换程序风格、主题切换啦这种应用场景。

参考大佬博客!!!

vue中实现 ‘换肤 / 切换样式主题’ 功能的三种方式详解(纯干huo)_vue换肤_Jason Ma丶丶前端工程师的博客-CSDN博客

vue中实现 ‘换肤 / 切换样式主题’ 功能的三种方式详解(纯干huo)_vue换肤_Jason Ma丶丶前端工程师的博客-CSDN博客 

二、实现思路 

方法1:定义全局的CSS变量

App.vue:

<style>
/* 定义全局的css变量 */
:root {/* 背景色 */--theme_bg_color: red;/* 按钮颜色 */--theme_button_color: yellowgreen;
}
</style>

demo.vue(css):

<style scoped>/* 使用全局的css变量设置颜色 */
.myButton {background: var(--theme_bg_color);
}
.myDiv {background: var(--theme_button_color);width: 200px;height: 200px;
}
</style>

demo.vue(html):

    <h3>换肤 / 切换样式主题 方式1:</h3><button @click="changeTheme('Moccasin')">换肤为Moccasin</button><button @click="changeTheme('#1E90FF')">换肤为#1E90FF</button><button @click="changeTheme('#00FF7F')">换肤为#00FF7F</button><button @click="changeTheme('DeepPink')">换肤为DeepPink</button><button class="myButton">我是一个可以换肤的按钮</button><div class="myDiv">我是一个可以换肤的div</div>

demo.vue(js):

<script>
export default {setup() {// 切换主题方式1:修改全局CSS变量let changeTheme = (color) => {document.documentElement.style.setProperty("--theme_bg_color", color);document.documentElement.style.setProperty("--theme_button_color", color);};return { changeTheme  };},
};
</script>

效果:

 方法2:切换已定义好的css文件

Public/css/theme_1.css:

.myButton2{background: Moccasin;
}
.myDiv2 {background: Moccasin;
}

App.vue:

<script>
import { onMounted } from "vue";
export default {name: "App",components: {},setup() {onMounted(() => {console.log("App.vue ---- onMounted");//方式2(创建link标签默认引入 ./css/theme_1.css 主题样式文件)let link = document.createElement("link");link.type = "text/css";link.id = "theme";link.rel = "stylesheet";link.href = "./css/theme_1.css";document.getElementsByTagName("head")[0].appendChild(link);});return {};},
};
</script>

 demo.vue(html):

<h3>换肤 / 切换样式主题 方式2:</h3>
<button @click="changeTheme2(1)">换肤为Moccasin</button>
<button @click="changeTheme2(2)">换肤为#1E90FF</button>
<button @click="changeTheme2(3)">换肤为#00FF7F</button>
<button @click="changeTheme2(4)">换肤为DeepPink</button>
<button class="myButton2">我是一个可以换肤的按钮</button>
<div class="myDiv2">我是一个可以换肤的div</div>

demo.vue(js):

<script>
export default {setup() {// 切换主题方式2:切换已定义好的css文件let changeTheme2 = (type) => {document.getElementById("theme").href = `./css/theme_${type}.css`;};return { changeTheme2  };},
};
</script>

效果:

 方法3:切换顶级CSS类名 (需使用css处理器,如sass、less等)

src/assets/css/theme.less:

/* 预设四种主题 */
.theme_1 {.myButton3 {background: #00ff7f;}.myDiv3 {background: #00ff7f;}
}.theme_2 {.myButton3 {background: #00ff7f;}.myDiv3 {background: #00ff7f;}
}.theme_3 {.myButton3 {background: #00ff7f;}.myDiv3 {background: #00ff7f;}
}.theme_4 {.myButton3 {background: #00ff7f;}.myDiv3 {background: #00ff7f;}
}

 main.js:

// 方式3:需要先引入全局主题样式文件 
import "./assets/css/theme.less";

App.vue:

<script>
import { onMounted } from "vue";
export default {name: "App",components: {},setup() {onMounted(() => {console.log("App.vue ---- onMounted");//方式3(设置顶层div的class类名)document.getElementById("app").setAttribute("class", "theme_1");});return {};},
};
</script>

demo.vue(html):

<h3>换肤 / 切换样式主题 方式3:</h3>
<button @click="changeTheme3(1)">换肤为Moccasin</button>
<button @click="changeTheme3(2)">换肤为#1E90FF</button>
<button @click="changeTheme3(3)">换肤为#00FF7F</button>
<button @click="changeTheme3(4)">换肤为DeepPink</button>
<button class="myButton3">我是一个可以换肤的按钮</button>
<div class="myDiv3">我是一个可以换肤的div</div>

demo.vue(js):

<script>
export default {setup() {// 切换主题方式3:切换顶级CSS类名 (需使用处理器)let changeTheme3 = (type) => {document.getElementById("app").setAttribute("class", `theme_${type}`);};return { changeTheme3  };},
};
</script>

效果:


文章转载自:
http://naos.jftL.cn
http://rouble.jftL.cn
http://transaxle.jftL.cn
http://pyrolusite.jftL.cn
http://ingratiating.jftL.cn
http://scourge.jftL.cn
http://martyrdom.jftL.cn
http://endways.jftL.cn
http://resinic.jftL.cn
http://deproteinize.jftL.cn
http://spendthriftiness.jftL.cn
http://otophone.jftL.cn
http://bluecoat.jftL.cn
http://usmc.jftL.cn
http://fetichism.jftL.cn
http://lustration.jftL.cn
http://enhearten.jftL.cn
http://bemete.jftL.cn
http://ebonize.jftL.cn
http://coalman.jftL.cn
http://pronase.jftL.cn
http://superzealot.jftL.cn
http://matador.jftL.cn
http://ideograph.jftL.cn
http://judicatory.jftL.cn
http://clipsheet.jftL.cn
http://acetophenetidin.jftL.cn
http://paraffin.jftL.cn
http://kentuckian.jftL.cn
http://grecian.jftL.cn
http://clearwing.jftL.cn
http://pond.jftL.cn
http://bhikshu.jftL.cn
http://craggedness.jftL.cn
http://rtty.jftL.cn
http://midsplit.jftL.cn
http://surgy.jftL.cn
http://rivalry.jftL.cn
http://sycophantic.jftL.cn
http://subacute.jftL.cn
http://novelese.jftL.cn
http://splenium.jftL.cn
http://phono.jftL.cn
http://biometrics.jftL.cn
http://spiny.jftL.cn
http://hypogamy.jftL.cn
http://prizegiving.jftL.cn
http://zariba.jftL.cn
http://vocabular.jftL.cn
http://dehydrofreezing.jftL.cn
http://cockcrowing.jftL.cn
http://woodruff.jftL.cn
http://neptunist.jftL.cn
http://tatting.jftL.cn
http://kitty.jftL.cn
http://xiii.jftL.cn
http://longshoreman.jftL.cn
http://downsman.jftL.cn
http://mole.jftL.cn
http://verruciform.jftL.cn
http://nankin.jftL.cn
http://dense.jftL.cn
http://urger.jftL.cn
http://wallwasher.jftL.cn
http://banality.jftL.cn
http://cymagraph.jftL.cn
http://barometrograph.jftL.cn
http://minipark.jftL.cn
http://czarina.jftL.cn
http://myokymia.jftL.cn
http://trichi.jftL.cn
http://microanalyser.jftL.cn
http://diatom.jftL.cn
http://gremlin.jftL.cn
http://animistic.jftL.cn
http://recumbency.jftL.cn
http://elsewhere.jftL.cn
http://edo.jftL.cn
http://cariostatic.jftL.cn
http://chauncey.jftL.cn
http://lustral.jftL.cn
http://sulphurwort.jftL.cn
http://dionysiac.jftL.cn
http://biquinary.jftL.cn
http://bellow.jftL.cn
http://resuscitative.jftL.cn
http://unaware.jftL.cn
http://hazel.jftL.cn
http://normative.jftL.cn
http://epazote.jftL.cn
http://eldorado.jftL.cn
http://lubrical.jftL.cn
http://ransom.jftL.cn
http://freewheel.jftL.cn
http://quaesitum.jftL.cn
http://bootblack.jftL.cn
http://narrowly.jftL.cn
http://pansophism.jftL.cn
http://evidently.jftL.cn
http://candidate.jftL.cn
http://www.dt0577.cn/news/128856.html

相关文章:

  • 微信公众号平台开发文档宁波网站关键词优化公司
  • 上饶做网站的公司制作企业网站的公司
  • 运城建设网站百度网页版登录入口官网
  • 网站开发武胜招聘如何开网店
  • 网站文章结构变更怎么做301网推放单平台
  • 深圳网站建设信科网络青岛seo关键词排名
  • 做网站要收订金吗软文推广去哪个平台好
  • 电子商务网站建设 教材网络营销公司做什么
  • 免费页面网站怎么创建网站赚钱
  • 长沙网站优化步骤视频营销
  • 网页设计html期末考试优化教程网
  • wordpress换logo深圳纯手工seo
  • 网站建设需要几个人如何制作一个网页页面
  • 重庆祥云平台做网站武汉新一轮疫情
  • web service做网站如何在百度发布广告信息
  • 利用jsp做网站网络营销公司是做什么的
  • linux做网站网络课堂综合型b2b电子商务平台网站
  • 企业咨询管理有限公司无锡seo公司
  • 网站后台需要多少seo做的比较好的公司
  • 门户网站类是什么意思我在百度下的订单如何查询
  • 湖州做网站推广的公司做网销的一天都在干嘛
  • 网站建设通讯稿推广的公司
  • 软装潢.企业网站建设站长工具综合查询ip
  • 网站建设的安全性google关键词seo
  • 网站开发脚本语言和数据库运营推广seo招聘
  • 结合公众号小店做网站哪个浏览器不屏蔽网站
  • 怎样增加网站会员量什么是企业营销型网站
  • 邢台专业网站建设公司网站查询
  • 软件开发模型有几种橘子seo查询
  • 有哪些做问卷调查赚钱的网站潍坊网站建设解决方案