-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(layout): page basic Construction
- Loading branch information
Showing
26 changed files
with
474 additions
and
292 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,99 @@ | ||
<template> | ||
<n-tree | ||
block-line | ||
expand-on-click | ||
:data="data" | ||
:node-props="nodeProps" | ||
:on-update:expanded-keys="updatePrefixWithExpaned" | ||
/> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, h } from 'vue'; | ||
import { useMessage, NIcon, TreeOption } from 'naive-ui'; | ||
import { Folder, FolderOpenOutline, FileTrayFullOutline } from '@vicons/ionicons5'; | ||
export default defineComponent({ | ||
setup() { | ||
const message = useMessage(); | ||
const updatePrefixWithExpaned = ( | ||
_keys: Array<string | number>, | ||
_option: Array<TreeOption | null>, | ||
meta: { | ||
node: TreeOption | null; | ||
action: 'expand' | 'collapse' | 'filter'; | ||
} | ||
) => { | ||
if (!meta.node) return; | ||
switch (meta.action) { | ||
case 'expand': | ||
meta.node.prefix = () => | ||
h(NIcon, null, { | ||
default: () => h(FolderOpenOutline) | ||
}); | ||
break; | ||
case 'collapse': | ||
meta.node.prefix = () => | ||
h(NIcon, null, { | ||
default: () => h(Folder) | ||
}); | ||
break; | ||
} | ||
}; | ||
const nodeProps = ({ option }: { option: TreeOption }) => { | ||
return { | ||
onClick() { | ||
if (!option.children && !option.disabled) { | ||
message.info('[Click] ' + option.label); | ||
} | ||
} | ||
}; | ||
}; | ||
return { | ||
updatePrefixWithExpaned, | ||
nodeProps, | ||
data: [ | ||
{ | ||
key: '文件夹', | ||
label: '文件夹', | ||
prefix: () => | ||
h(NIcon, null, { | ||
default: () => h(Folder) | ||
}), | ||
children: [ | ||
{ | ||
key: '空的', | ||
label: '空的', | ||
disabled: true, | ||
prefix: () => | ||
h(NIcon, null, { | ||
default: () => h(Folder) | ||
}) | ||
}, | ||
{ | ||
key: '我的文件', | ||
label: '我的文件', | ||
prefix: () => | ||
h(NIcon, null, { | ||
default: () => h(Folder) | ||
}), | ||
children: [ | ||
{ | ||
label: 'template.txt', | ||
key: 'template.txt', | ||
prefix: () => | ||
h(NIcon, null, { | ||
default: () => h(FileTrayFullOutline) | ||
}) | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}; | ||
} | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"></style> |
7 changes: 0 additions & 7 deletions
7
src/layouts/components/Header/components/FileManagement/index.vue
This file was deleted.
Oops, something went wrong.
17 changes: 15 additions & 2 deletions
17
src/layouts/components/Header/components/Setting/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 |
---|---|---|
@@ -1,13 +1,26 @@ | ||
<template> | ||
<svg-icon :name="name" :icon-style="iconStyle"></svg-icon> | ||
<n-popover placement="right" trigger="hover"> | ||
<template #trigger> | ||
<svg-icon :name="name" :icon-style="iconStyle" @click="handleSetting" /> | ||
</template> | ||
{{ t('Custom Setting') }} | ||
</n-popover> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { CSSProperties } from 'vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
import SvgIcon from '@/components/SvgIcon/index.vue'; | ||
defineProps<{ | ||
const { t } = useI18n(); | ||
const props = defineProps<{ | ||
name: string; | ||
iconStyle: CSSProperties; | ||
onClick: () => void; | ||
}>(); | ||
const handleSetting = () => { | ||
props.onClick(); | ||
}; | ||
</script> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<template> | ||
<n-drawer | ||
v-model:show="showSettingDrawer" | ||
:default-width="502" | ||
placement="right" | ||
resizable | ||
closable | ||
> | ||
<n-drawer-content :title="t('Custom Setting')"> | ||
<n-flex justify="space-around" align="center"> | ||
主题切换: | ||
<n-switch /> | ||
</n-flex> | ||
</n-drawer-content> | ||
</n-drawer> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { onBeforeUnmount, ref } from 'vue'; | ||
import { useI18n } from 'vue-i18n'; | ||
import mittBus from '@/utils/mittBus.ts'; | ||
const { t } = useI18n(); | ||
const showSettingDrawer = ref<Boolean>(false); | ||
mittBus.on('openSettingDrawer', () => { | ||
showSettingDrawer.value = true; | ||
}); | ||
onBeforeUnmount(() => { | ||
mittBus.off('openSettingDrawer'); | ||
}); | ||
</script> | ||
|
||
<style scoped lang="scss"></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
Oops, something went wrong.