Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: 第二次提交 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
feat: 第二次提交 #1
Changes from all commits
084c3e13df8a25File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
��# css
css
方案一:link 标签动态引入
其做法就是提前准备好几套 CSS 主题样式文件,在需要的时候,创建 link 标签动态加载到 head 标签中,或者是动态改变 link 标签的 href 属性
方案二:提前引入所有主题样式,做类名切换
这种方案与第一种比较类似,为了解决反复加载样式文件问题提前将样式全部引入,在需要切换主题的时候将指定的根元素类名更换,相当于直接做了样式覆盖,在该类名下的各个样式就统一地更换了。
方案 3:CSS 变量+类名切换
方案 4:Vue3 新特性(v-bind)
虽然这种方式存在局限性只能在 Vue 开发中使用,但是为 Vue 项目开发者做动态样式更改提供了又一个不错的方案。
方案 5:SCSS + mixin + 类名切换
主要是运用 SCSS 的混合+CSS 类名切换,其原理主要是将使用到 mixin 混合的地方编译为固定的 CSS 以后,再通过类名切换去做样式的覆盖
方案 6:CSS 变量+动态 setProperty
此方案较于前几种会更加灵活,不过视情况而定,这个方案适用于由用户根据颜色面板自行设定各种颜色主题,这种是主题颜色不确定的情况,而前几种方案更适用于定义预设的几种主题。 方案参考:vue-element-plus-admin 主要实现思路如下: 只需在全局中设置好预设的全局 CSS 变量样式,无需单独为每一个主题类名下重新设定 CSS 变量值,因为主题是由用户动态决定。
定义一个工具类方法,用于修改指定的 CSS 变量值,调用的是 CSSStyleDeclaration.setProperty
在样式发生改变时调用此方法即可
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.