Coder Social home page Coder Social logo

Comments (15)

qmhc avatar qmhc commented on June 19, 2024

你是否给页面的背景色设置了白色?main 部分应该是透明的。

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

没有设置白色的背景, 我给你看一下代码

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

image

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

这是我的main.ts
image

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

只要我重新点左上角的头像,在里面切换深色模式,main的内容会变深色,但是我只要刷新main就会变成白色

from vexip-ui.

qmhc avatar qmhc commented on June 19, 2024

你可以往上挨个检查元素的背景色是否被设置,因为 main 部分(即白色的部分)的背景颜色是透明的。

如果你还是没找到,那最好你可以提供一个复现的项目。

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

image
这是我的pinia源码, 我检查过上级元素, 并没有设置白色, css我没有写过, 不过我还是会试着找出问题的, 不过现在还没有什么头绪...

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

检查了元素, 使用正则匹配查找, 都没有设置白色背景, 或者是我的main.ts有问题,稍等我截图一下,然后需要复现问题等我把源代码上传到git

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

image

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

还是不可以, 我试过了, 我还尝试了一个场景, 就是在我什么都不配置的情况下, 用 layout 组件, 通过点右上角头像切换称 dark 主题之后, 刷新一次页面还是会变成light, 官网上也是如此, 默认是dark主题, 我再切换成 light 主题刷新页面, 会变成 dark 主题。。。。, 我实在不知道是什么原因了, 也可能是我使用的是 linux 的原因 ?现在目前看来只能相信玄学了

from vexip-ui.

qmhc avatar qmhc commented on June 19, 2024

如果你想持久化主题,你需要自己做持久化保存。比如像文档,是通过 localStorage 持久化的:

image

然后在 dark-mode 属性变化时保存到 localStorage:

image

Layout 组件的 dark-mode 属性是同时可以用来指定内部切换主题 Switch 的初始值的,但如果你通过 document.documentElement 的类名来动态添加 'dark' 类名,Layout 初始化时会检测它。

文档的 Layout 示例没有做持久化操作,当然你刷新之后就会变回原来的主题了。

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

我一开始就是通过这种方式持久化了主题, 然而就会出现上面的问题

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

请稍等一会, 明天我会上传问题的项目,把这个 bug 复刻出来

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

太不好意思了,,,这几天有点事,问题已经复现并上传
https://github.com/NatholDallas/enshrine/blob/dev/client/src/views/HomeView.vue

from vexip-ui.

natholdallas avatar natholdallas commented on June 19, 2024

目前修复这个问题的只能手动修复,在LayoutMain 中判断是否 Darkmode 然后自己设置颜色, 黑色就是 #121212, 白色主题就是 #ffffff..................

from vexip-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.