docs: 集成 dark-reader
This commit is contained in:
parent
8fb2b66fe5
commit
5b31ce43c5
@ -43,6 +43,7 @@
|
|||||||
"@layui/layer-vue": "^1.3.11",
|
"@layui/layer-vue": "^1.3.11",
|
||||||
"@vueuse/core": "^7.6.2",
|
"@vueuse/core": "^7.6.2",
|
||||||
"async-validator": "^4.0.7",
|
"async-validator": "^4.0.7",
|
||||||
|
"darkreader": "^4.9.46",
|
||||||
"evtd": "^0.2.3",
|
"evtd": "^0.2.3",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"uuid": "^8.3.2",
|
"uuid": "^8.3.2",
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
ButtonSize,
|
ButtonSize,
|
||||||
ButtonType,
|
ButtonType,
|
||||||
} from "./interface";
|
} from "./interface";
|
||||||
import { BooleanOrString, String } from "src/types";
|
import { BooleanOrString, String } from "../../types";
|
||||||
|
|
||||||
export interface LayButtonProps {
|
export interface LayButtonProps {
|
||||||
type?: ButtonType;
|
type?: ButtonType;
|
||||||
|
@ -7,7 +7,7 @@ export default {
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, useSlots } from "vue";
|
import { computed, useSlots } from "vue";
|
||||||
import "./index.less";
|
import "./index.less";
|
||||||
import { String } from "src/types";
|
import { String } from "../../types";
|
||||||
import { CardShadow } from "./interface";
|
import { CardShadow } from "./interface";
|
||||||
|
|
||||||
const slot = useSlots();
|
const slot = useSlots();
|
||||||
|
1
src/component/datePicker/interface.ts
Normal file
1
src/component/datePicker/interface.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export type DatePickerType = "date" | "datetime" | "year" | "time" | "month";
|
@ -7,6 +7,11 @@ export default {
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { watch } from "vue";
|
import { watch } from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
|
import {
|
||||||
|
enable as enableDarkMode,
|
||||||
|
disable as disableDarkMode,
|
||||||
|
} from "darkreader";
|
||||||
|
|
||||||
const { locale, setLocaleMessage, mergeLocaleMessage } = useI18n();
|
const { locale, setLocaleMessage, mergeLocaleMessage } = useI18n();
|
||||||
|
|
||||||
export interface LayConfigProviderProps {
|
export interface LayConfigProviderProps {
|
||||||
@ -34,8 +39,15 @@ const changeLocales = (lang: string, locales: any, merge: boolean) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const changeTheme = (theme: string) => {
|
const changeTheme = (theme: string) => {
|
||||||
document.body.removeAttribute("lay-theme");
|
if (theme === "dark") {
|
||||||
document.body.setAttribute("lay-theme", theme);
|
enableDarkMode({
|
||||||
|
brightness: 100,
|
||||||
|
contrast: 90,
|
||||||
|
sepia: 10,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
disableDarkMode();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const changeThemeVariable = (vars: any) => {
|
const changeThemeVariable = (vars: any) => {
|
||||||
|
@ -44,10 +44,6 @@
|
|||||||
|
|
||||||
--global-border-radius: 2px;
|
--global-border-radius: 2px;
|
||||||
|
|
||||||
--global-fore-color: #333;
|
|
||||||
|
|
||||||
--global-back-color: #ffffff;
|
|
||||||
|
|
||||||
--global-neutral-color-1: #FAFAFA;
|
--global-neutral-color-1: #FAFAFA;
|
||||||
|
|
||||||
--global-neutral-color-2: #F6F6F6;
|
--global-neutral-color-2: #F6F6F6;
|
||||||
@ -63,27 +59,5 @@
|
|||||||
--global-neutral-color-7: #cccccc;
|
--global-neutral-color-7: #cccccc;
|
||||||
|
|
||||||
--global-neutral-color-8: #c2c2c2;
|
--global-neutral-color-8: #c2c2c2;
|
||||||
}
|
|
||||||
|
|
||||||
body[lay-theme="dark"] {
|
|
||||||
|
|
||||||
--global-fore-color: #ffffff;
|
}
|
||||||
|
|
||||||
--global-back-color: #333;
|
|
||||||
|
|
||||||
--global-neutral-color-1: #FAFAFA;
|
|
||||||
|
|
||||||
--global-neutral-color-2: #F6F6F6;
|
|
||||||
|
|
||||||
--global-neutral-color-3: #eeeeee;
|
|
||||||
|
|
||||||
--global-neutral-color-4: #e2e2e2;
|
|
||||||
|
|
||||||
--global-neutral-color-5: #dddddd;
|
|
||||||
|
|
||||||
--global-neutral-color-6: #d2d2d2;
|
|
||||||
|
|
||||||
--global-neutral-color-7: #cccccc;
|
|
||||||
|
|
||||||
--global-neutral-color-8: #c2c2c2;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user