web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. seo教程
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站

Layui - Vue启用日间模式/夜间模式

406 ℃
     

​​默认情况下,使用 layui-vue 搭建的网站主题为日间模式。那么如何启用夜间模式呢?下面web建站小编给大家简单介绍一下具体实现代码!

若启用夜间模式, 将 config-provider 组件 theme 属性设置为 dark 值。

<template>
    <lay-config-provider :theme="theme">
        <App />
    </lay-config-provider>
</template>

<script setup>
const theme = ref('dark')
</script>

选项配置

默认的夜间模式不满足要求时, 可通过 config-provider 组件 dark-partial 属性进行偏好设置。

<template>
    <lay-config-provider :theme="theme" :dark-partial="darkPartial">
        <App />
    </lay-config-provider>
</template>

<script setup>
const theme = ref('dark')

const darkPartial = {
    brightness: 100,
    contrast: 90,
    grayscale: 0,
    darkSchemeBackgroundColor: "black";
    darkSchemeTextColor: "white";
}
</script>

Dark Partial属性介绍

属性 描述 类型 默认值 可选值
brightness 亮度 number 100 0 – 100
contrast 对比度 number 100 0 – 100
grayscale 灰度值 number 0 0 – 100
darkSchemeBackgroundColor 背景颜色 string
darkSchemeTextColor 前景颜色 string

推荐9款支持 Vue3 免费开源的前端 UI 组件库

基于Vite/TypeScript/Vue3/ElementPlus+TinkPHP6前后端一体框架——Niucloud Admin

免费开源企业级前端 UI 组件库——TinyVue

免费开源的 Vue 3 桌面端 UI 组件库——Layui Vue

Layui - Vue如何设置默认语言

标签: Layui Vue, Vue3免费开源组件, Vue3组件库, 桌面端UI组件库

上面是“Layui - Vue启用日间模式/夜间模式”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_13027.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > vuejs
本文共计743个字,预计阅读时长5分钟
生活小工具,收录了80多款小工具
上一篇: 推荐一个可以查询老黄历的网站,可以根据五行取名!
下一篇: 详细介绍HTTP状态码不同之处的原因(什么原因导致的)
x 打工人ai神器