-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
912bfdf
commit 6d132c5
Showing
10 changed files
with
269 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
src/layouts/common/SettingDrawer/components/PageFunc/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<template> | ||
<n-divider title-placement="center">界面功能</n-divider> | ||
<n-space vertical size="large"> | ||
<setting-menu label="固定头部和多页签"> | ||
<n-switch :value="theme.fixedHeaderAndTab" @update:value="setIsFixedHeaderAndTab" /> | ||
</setting-menu> | ||
<setting-menu label="顶部菜单位置"> | ||
<n-select | ||
class="w-120px" | ||
size="small" | ||
:value="theme.menu.horizontalPosition" | ||
:options="theme.menu.horizontalPositionList" | ||
@update:value="setHorizontalMenuPosition" | ||
/> | ||
</setting-menu> | ||
<setting-menu label="头部高度"> | ||
<n-input-number | ||
class="w-120px" | ||
size="small" | ||
:value="theme.header.height" | ||
:step="1" | ||
@update:value="handleSetNumber($event, setHeaderHeight)" | ||
/> | ||
</setting-menu> | ||
<setting-menu label="多页签高度"> | ||
<n-input-number | ||
class="w-120px" | ||
size="small" | ||
:value="theme.tab.height" | ||
:step="1" | ||
@update:value="handleSetNumber($event, setTabHeight)" | ||
/> | ||
</setting-menu> | ||
<setting-menu label="多页签缓存"> | ||
<n-switch :value="theme.tab.isCache" @update:value="setTabIsCache" /> | ||
</setting-menu> | ||
<setting-menu label="侧边栏展开宽度"> | ||
<n-input-number | ||
class="w-120px" | ||
size="small" | ||
:value="theme.sider.width" | ||
:step="10" | ||
@update:value="handleSetNumber($event, setSiderWidth)" | ||
/> | ||
</setting-menu> | ||
<setting-menu label="左侧混合侧边栏展开宽度"> | ||
<n-input-number | ||
class="w-120px" | ||
size="small" | ||
:value="theme.sider.mixWidth" | ||
:step="5" | ||
@update:value="handleSetNumber($event, setMixSiderWidth)" | ||
/> | ||
</setting-menu> | ||
</n-space> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { NDivider, NSpace, NSwitch, NSelect, NInputNumber } from 'naive-ui'; | ||
import { useThemeStore } from '@/store'; | ||
import SettingMenu from '../SettingMenu/index.vue'; | ||
const theme = useThemeStore(); | ||
const { | ||
setHorizontalMenuPosition, | ||
setIsFixedHeaderAndTab, | ||
setHeaderHeight, | ||
setTabHeight, | ||
setSiderWidth, | ||
setMixSiderWidth, | ||
setTabIsCache | ||
} = useThemeStore(); | ||
function handleSetNumber(value: number | null, callback: (value: number) => void) { | ||
if (value !== null) { | ||
callback(value); | ||
} | ||
} | ||
</script> | ||
<style scoped></style> |
52 changes: 52 additions & 0 deletions
52
src/layouts/common/SettingDrawer/components/PageView/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<template> | ||
<n-divider title-placement="center">界面显示</n-divider> | ||
<n-space vertical size="large"> | ||
<setting-menu label="面包屑"> | ||
<n-switch :value="theme.header.crumb.visible" @update:value="setHeaderCrumbVisible" /> | ||
</setting-menu> | ||
<setting-menu label="面包屑图标"> | ||
<n-switch :value="theme.header.crumb.showIcon" @update:value="setHeaderCrumbIconVisible" /> | ||
</setting-menu> | ||
<setting-menu label="多页签"> | ||
<n-switch :value="theme.tab.visible" @update:value="setTabVisible" /> | ||
</setting-menu> | ||
<setting-menu label="多页签风格"> | ||
<n-select | ||
class="w-120px" | ||
size="small" | ||
:value="theme.tab.mode" | ||
:options="theme.tab.modeList" | ||
@update:value="setTabMode" | ||
/> | ||
</setting-menu> | ||
<setting-menu label="页面切换动画"> | ||
<n-switch :value="theme.page.animate" @update:value="setPageIsAnimate" /> | ||
</setting-menu> | ||
<setting-menu label="页面切换动画类型"> | ||
<n-select | ||
class="w-120px" | ||
size="small" | ||
:value="theme.page.animateMode" | ||
:options="theme.page.animateModeList" | ||
@update:value="setPageAnimateMode" | ||
/> | ||
</setting-menu> | ||
</n-space> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { NDivider, NSpace, NSwitch, NSelect } from 'naive-ui'; | ||
import { useThemeStore } from '@/store'; | ||
import SettingMenu from '../SettingMenu/index.vue'; | ||
const theme = useThemeStore(); | ||
const { | ||
setHeaderCrumbVisible, | ||
setHeaderCrumbIconVisible, | ||
setTabVisible, | ||
setTabMode, | ||
setPageIsAnimate, | ||
setPageAnimateMode | ||
} = useThemeStore(); | ||
</script> | ||
<style scoped></style> |
16 changes: 16 additions & 0 deletions
16
src/layouts/common/SettingDrawer/components/SettingMenu/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<template> | ||
<div class="flex-y-center justify-between"> | ||
<span>{{ label }}</span> | ||
<slot></slot> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
interface Props { | ||
/** 文本 */ | ||
label: string; | ||
} | ||
defineProps<Props>(); | ||
</script> | ||
<style scoped></style> |
57 changes: 57 additions & 0 deletions
57
src/layouts/common/SettingDrawer/components/ThemeConfig/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<n-divider title-placement="center">主题配置</n-divider> | ||
<n-space vertical> | ||
<div ref="copyRef" :data-clipboard-text="dataClipboardText"> | ||
<n-button type="primary" :block="true">拷贝当前配置</n-button> | ||
</div> | ||
<n-button type="warning" :block="true" @click="handleResetConfig">重置当前配置</n-button> | ||
</n-space> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, watch, onMounted, onUnmounted } from 'vue'; | ||
import { NDivider, NSpace, NButton } from 'naive-ui'; | ||
import Clipboard from 'clipboard'; | ||
import { useThemeStore } from '@/store'; | ||
const theme = useThemeStore(); | ||
const copyRef = ref<HTMLElement | null>(null); | ||
const dataClipboardText = ref(getClipboardText()); | ||
function getClipboardText() { | ||
return JSON.stringify(theme.$state); | ||
} | ||
function handleResetConfig() { | ||
theme.resetThemeStore(); | ||
window.$message?.success('已重置配置,请重新拷贝!'); | ||
} | ||
function clipboardEventListener() { | ||
const copy = new Clipboard(copyRef.value!); | ||
copy.on('success', () => { | ||
window.$dialog?.success({ | ||
title: '操作成功', | ||
content: '复制成功,请替换 src/settings/theme.json的内容!', | ||
positiveText: '确定' | ||
}); | ||
}); | ||
} | ||
const stopHandle = watch( | ||
() => theme.$state, | ||
() => { | ||
dataClipboardText.value = getClipboardText(); | ||
}, | ||
{ deep: true } | ||
); | ||
onMounted(() => { | ||
clipboardEventListener(); | ||
}); | ||
onUnmounted(() => { | ||
stopHandle(); | ||
}); | ||
</script> | ||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters