From 6dbfdd589ebf004183895db43fbb40facf584174 Mon Sep 17 00:00:00 2001
From: hyl <3307378337@qq.com>
Date: Mon, 13 May 2024 15:33:47 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E4=BB=B6+?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 3 ++-
src/App.vue | 4 +++-
src/components/Dropdown/index.vue | 13 ++++++-------
src/components/Popover/index.vue | 13 +++----------
src/components/Tooltip/index.vue | 17 +++++-----------
src/components/common.ts | 32 ++++++++++++++++---------------
tsconfig.json | 2 +-
7 files changed, 37 insertions(+), 47 deletions(-)
diff --git a/package.json b/package.json
index bceab89..a9cb213 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,8 @@
"preview": "vitepress preview docs",
"type-check": "vue-tsc --build --force",
"release": "vite build --config release.config.ts",
- "test": "vitest"
+ "test": "vitest",
+ "dev-web": "vite"
},
"dependencies": {
"@floating-ui/vue": "^1.0.6",
diff --git a/src/App.vue b/src/App.vue
index 0f0cca2..e9a0087 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,5 +1,7 @@
-
+
+ 111
+
diff --git a/src/components/Tooltip/index.vue b/src/components/Tooltip/index.vue
index 0aead67..402c0c7 100644
--- a/src/components/Tooltip/index.vue
+++ b/src/components/Tooltip/index.vue
@@ -21,23 +21,16 @@ import { inject, ref, watch, nextTick, onMounted, onUnmounted, computed } from '
import { $config, $configInit } from '@/config'
import { computePosition, flip, offset, shift, useFloating } from '@floating-ui/vue'
import { debounce } from 'lodash'
-import type { Placement, Trigger } from '@/components/common'
+import type { TooltipProps } from '@/components/common'
defineOptions({
inheritAttrs: false
})
-const props = withDefaults(
- defineProps<{
- placement?: Placement
- content?: string
- trigger?: Trigger
- }>(),
- {
- placement: 'top',
- trigger: 'hover'
- }
-)
+const props = withDefaults(defineProps(), {
+ placement: 'top',
+ trigger: 'hover'
+})
const { ns } = inject($config, $configInit)!
diff --git a/src/components/common.ts b/src/components/common.ts
index c2bdb92..67ea248 100644
--- a/src/components/common.ts
+++ b/src/components/common.ts
@@ -2,18 +2,20 @@ export type Options = { label: string; value: string }[]
export type Direction = 'vertical' | 'horizontal'
-export type Trigger = 'hover' | 'click'
-
-export type Placement =
- | 'top'
- | 'top-start'
- | 'top-end'
- | 'bottom'
- | 'bottom-start'
- | 'bottom-end'
- | 'left'
- | 'left-start'
- | 'left-end'
- | 'right'
- | 'right-start'
- | 'right-end'
+export interface TooltipProps {
+ placement?:
+ | 'top'
+ | 'top-start'
+ | 'top-end'
+ | 'bottom'
+ | 'bottom-start'
+ | 'bottom-end'
+ | 'left'
+ | 'left-start'
+ | 'left-end'
+ | 'right'
+ | 'right-start'
+ | 'right-end'
+ content?: string
+ trigger?: 'hover' | 'click'
+}
diff --git a/tsconfig.json b/tsconfig.json
index ed1b3c6..a1ac31d 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,6 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
- "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "src/**/*.ts","docs/**/*.vue"],
+ "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "src/**/*.ts","docs/**/*.vue","docs/**/*.ts"],
"exclude": ["src/**/__tests__/*"],
"compilerOptions": {
"composite": true,