wip(login): login developing

This commit is contained in:
陈凯龙
2021-12-31 17:19:53 +08:00
parent bc749702b5
commit 45d657d44c
23 changed files with 3413 additions and 12 deletions

View File

@@ -0,0 +1,3 @@
import VThemeSwitch from './src/VThemeSwitch.vue'
export { VThemeSwitch }

View File

@@ -0,0 +1,48 @@
<script setup lang="ts">
import { ref } from 'vue'
import { useAppStore } from '@/store/modules/app'
import Sun from '~icons/emojione-monotone/sun'
import CrescentMoon from '~icons/emojione-monotone/crescent-moon'
import { ElSwitch } from 'element-plus'
import { useCssVar } from '@vueuse/core'
import { useDesign } from '@/hooks/web/useDesign'
const appStore = useAppStore()
// 初始化获取是否是暗黑主题
const isDark = ref(appStore.getIsDark)
const { getPrefixCls } = useDesign()
const prefixCls = getPrefixCls('theme-switch')
// 设置switch的背景颜色
const blackColor = useCssVar('--el-color-black', document.documentElement)
function themeChange(val: boolean) {
appStore.setIsDark(val)
}
</script>
<template>
<ElSwitch
:class="prefixCls"
v-model="isDark"
inline-prompt
:border-color="blackColor"
:inactive-color="blackColor"
:active-color="blackColor"
:active-icon="Sun"
:inactive-icon="CrescentMoon"
@change="themeChange"
/>
</template>
<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-theme-switch';
.@{prefix-cls} {
:deep(.el-icon) {
color: #fde047;
}
}
</style>