فهرست منبع

🦄 refactor(type): 处理指令类型

陈雪 1 ماه پیش
والد
کامیت
7825513a2e
3فایلهای تغییر یافته به همراه12 افزوده شده و 13 حذف شده
  1. 12 0
      src/types/directives.d.ts
  2. 0 7
      src/typings.d.ts
  3. 0 6
      src/typings.ts

+ 12 - 0
src/types/directives.d.ts

@@ -0,0 +1,12 @@
+/* eslint-disable */
+/// <reference types="vite/client" />
+import { FormatDirective } from '@/directives/format'
+
+// 关键:必须导入 'vue' 以合并类型
+import 'vue'
+
+declare module 'vue' {
+  interface ComponentCustomProperties {
+    vFormat: FormatDirective
+  }
+}

+ 0 - 7
src/typings.d.ts

@@ -1,6 +1,5 @@
 // 全局要用的类型放到这里
 import { ObjectDirective } from 'vue'
-import { FormatType } from './directives/format'
 
 declare global {
   type IResData<T> = {
@@ -19,10 +18,4 @@ declare global {
   }
 }
 
-declare module '@vue/runtime-core' {
-  interface ComponentCustomProperties {
-    vFormat: (el: HTMLElement, { value }: DirectiveBinding<FormatType>) => void
-  }
-}
-
 export {} // 防止模块污染

+ 0 - 6
src/typings.ts

@@ -1,6 +0,0 @@
-// 枚举定义
-
-export enum TestEnum {
-  A = '1',
-  B = '2',
-}