Skip to content

Commit

Permalink
refactor(projects): 代码优化
Browse files Browse the repository at this point in the history
ISSUES CLOSED: \
  • Loading branch information
honghuangdc committed May 28, 2022
1 parent be45d83 commit 4c2f535
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,8 @@ pnpm dev
pnpm build
```

::: warning 注意

**本地环境需要安装 pnpm 6.x 、Node.js 14.x 和 Git**

:::

## 如何贡献

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "8.7.1",
"eslint-plugin-vue": "8.7.1",
"husky": "^8.0.1",
"lint-staged": "^12.4.2",
"mockjs": "^1.1.0",
Expand All @@ -95,7 +95,6 @@
"vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-mock": "^2.9.6",
"vue-tsc": "^0.34.16",
"vueuc": "^0.4.37"
"vue-tsc": "^0.34.16"
}
}
20 changes: 18 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions src/components/common/HoverContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
<div v-if="showTooltip">
<n-tooltip :placement="placement" trigger="hover">
<template #trigger>
<div class="flex-center h-full cursor-pointer dark:hover:bg-[#333]" :class="computedClass">
<div class="flex-center h-full cursor-pointer dark:hover:bg-[#333]" :class="contentClassName">
<slot></slot>
</div>
</template>
{{ tooltipContent }}
</n-tooltip>
</div>
<div v-else class="flex-center cursor-pointer dark:hover:bg-[#333]" :class="computedClass">
<div v-else class="flex-center cursor-pointer dark:hover:bg-[#333]" :class="contentClassName">
<slot></slot>
</div>
</template>

<script lang="ts" setup>
import { computed } from 'vue';
import type { FollowerPlacement } from 'vueuc';
import type { PopoverPlacement } from 'naive-ui';
interface Props {
/** tooltip显示文本 */
tooltipContent?: string;
/** tooltip的位置 */
placement?: FollowerPlacement;
placement?: PopoverPlacement;
/** class类 */
contentClass?: string;
/** 反转模式下 */
Expand All @@ -37,8 +37,8 @@ const props = withDefaults(defineProps<Props>(), {
const showTooltip = computed(() => Boolean(props.tooltipContent));
const computedClass = computed(() =>
[props.contentClass, props.inverted ? 'hover:bg-primary' : 'hover:bg-[#f6f6f6]'].join(' ')
const contentClassName = computed(
() => `${props.contentClass} ${props.inverted ? 'hover:bg-primary' : 'hover:bg-[#f6f6f6]'}`
);
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<script setup lang="ts">
import { computed } from 'vue';
import type { FollowerPlacement } from 'vueuc';
import type { PopoverPlacement } from 'naive-ui';
import type { EnumThemeLayoutMode } from '@/enum';
interface Props {
Expand All @@ -34,7 +34,7 @@ const props = defineProps<Props>();
type LayoutConfig = Record<
EnumType.ThemeLayoutMode,
{
placement: FollowerPlacement;
placement: PopoverPlacement;
menuClass: string;
mainClass: string;
}
Expand Down

1 comment on commit 4c2f535

@vercel
Copy link

@vercel vercel bot commented on 4c2f535 May 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.