Skip to content

Commit

Permalink
Add icon size setter
Browse files Browse the repository at this point in the history
  • Loading branch information
xingrz committed Mar 24, 2024
1 parent 7a4d156 commit 31940c9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/AppMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
</template>

<script lang="ts" setup>
import { ref, type ComponentPublicInstance } from 'vue';
import { h, ref, type ComponentPublicInstance } from 'vue';
import {
type MenuOption,
NButton,
NDropdown,
} from 'naive-ui';
import SizeSetter from './AppMenu/SizeSetter.vue';
const menuItems: MenuOption[] = [
{
label: '文件',
Expand Down Expand Up @@ -53,6 +55,14 @@ const menuItems: MenuOption[] = [
label: '视图',
key: 'view',
children: [
{
key: 'icon-size',
type: 'render',
render: () => h(SizeSetter),
},
{
type: 'divider',
},
{
label: '放大',
key: 'zoom-in',
Expand Down
27 changes: 27 additions & 0 deletions src/components/AppMenu/SizeSetter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<div :class="$style.setter">
<span>图标大小</span>
<n-slider v-model:value="editorStore.size" :min="20" :max="60" />
</div>
</template>

<script lang="ts" setup>
import {
NSlider,
} from 'naive-ui';
import { useEditorStore } from '@/stores/editor';
const editorStore = useEditorStore();
</script>

<style lang="scss" module>
.setter {
display: flex;
flex-direction: column;
gap: 4px;
width: 200px;
padding: 8px var(--n-option-prefix-width);
font-size: var(--n-font-size);
}
</style>

0 comments on commit 31940c9

Please sign in to comment.