morghulis 2.0.51 → 2.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +23 -13
- package/package.json +1 -1
- package/typings/volar.d.ts +4 -65
package/index.d.ts
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
import
|
1
|
+
import { App, DefineComponent, ComponentOptions } from 'vue';
|
2
2
|
|
3
|
-
//
|
3
|
+
// 定义常量类型
|
4
4
|
export type ButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
|
5
|
-
|
6
|
-
// 按钮尺寸
|
7
5
|
export type ButtonSize = 'large' | 'default' | 'small';
|
8
6
|
|
9
|
-
//
|
7
|
+
// 定义按钮组件属性接口
|
10
8
|
export interface MButtonProps {
|
11
9
|
/**
|
12
10
|
* 按钮类型
|
@@ -63,23 +61,35 @@ export interface MButtonProps {
|
|
63
61
|
text?: string;
|
64
62
|
}
|
65
63
|
|
66
|
-
//
|
67
|
-
export
|
64
|
+
// 导出组件
|
65
|
+
export const MButton: DefineComponent<MButtonProps, {}, {}, {}, {
|
66
|
+
click: (event: MouseEvent) => void
|
67
|
+
}>;
|
68
68
|
|
69
|
-
//
|
70
|
-
export
|
69
|
+
// 导出插件方法
|
70
|
+
export function install(app: App): void;
|
71
71
|
|
72
72
|
// 默认导出
|
73
73
|
declare const _default: {
|
74
74
|
install: typeof install;
|
75
75
|
MButton: typeof MButton;
|
76
76
|
};
|
77
|
-
|
78
77
|
export default _default;
|
79
78
|
|
80
|
-
//
|
81
|
-
declare module 'vue' {
|
82
|
-
interface GlobalComponents {
|
79
|
+
// 扩展 @vue/runtime-core 以支持全局组件类型
|
80
|
+
declare module '@vue/runtime-core' {
|
81
|
+
export interface GlobalComponents {
|
83
82
|
MButton: typeof MButton;
|
84
83
|
}
|
84
|
+
}
|
85
|
+
|
86
|
+
// 支持JSX
|
87
|
+
declare global {
|
88
|
+
namespace JSX {
|
89
|
+
interface IntrinsicElements {
|
90
|
+
'MButton': MButtonProps & {
|
91
|
+
onClick?: (event: MouseEvent) => void
|
92
|
+
};
|
93
|
+
}
|
94
|
+
}
|
85
95
|
}
|
package/package.json
CHANGED
package/typings/volar.d.ts
CHANGED
@@ -1,73 +1,12 @@
|
|
1
|
-
// Volar
|
2
|
-
|
1
|
+
// Volar专用类型定义 - 用于TypeScript服务器识别
|
2
|
+
|
3
|
+
import type { ButtonType, ButtonSize, MButtonProps } from '../index';
|
3
4
|
|
4
5
|
declare module 'vue' {
|
5
6
|
export interface GlobalComponents {
|
6
7
|
/**
|
7
8
|
* 按钮组件
|
8
9
|
*/
|
9
|
-
MButton:
|
10
|
-
$props: {
|
11
|
-
/**
|
12
|
-
* 按钮类型
|
13
|
-
* @default 'default'
|
14
|
-
*/
|
15
|
-
type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text'
|
16
|
-
|
17
|
-
/**
|
18
|
-
* 按钮尺寸
|
19
|
-
* @default 'default'
|
20
|
-
*/
|
21
|
-
size?: 'large' | 'default' | 'small'
|
22
|
-
|
23
|
-
/**
|
24
|
-
* 是否为朴素按钮
|
25
|
-
* @default false
|
26
|
-
*/
|
27
|
-
plain?: boolean
|
28
|
-
|
29
|
-
/**
|
30
|
-
* 是否为圆角按钮
|
31
|
-
* @default false
|
32
|
-
*/
|
33
|
-
round?: boolean
|
34
|
-
|
35
|
-
/**
|
36
|
-
* 是否为圆形按钮
|
37
|
-
* @default false
|
38
|
-
*/
|
39
|
-
circle?: boolean
|
40
|
-
|
41
|
-
/**
|
42
|
-
* 是否禁用按钮
|
43
|
-
* @default false
|
44
|
-
*/
|
45
|
-
disabled?: boolean
|
46
|
-
|
47
|
-
/**
|
48
|
-
* 是否显示加载状态
|
49
|
-
* @default false
|
50
|
-
*/
|
51
|
-
loading?: boolean
|
52
|
-
|
53
|
-
/**
|
54
|
-
* 按钮图标类名
|
55
|
-
*/
|
56
|
-
icon?: string
|
57
|
-
|
58
|
-
/**
|
59
|
-
* 按钮文本
|
60
|
-
*/
|
61
|
-
text?: string
|
62
|
-
}
|
63
|
-
|
64
|
-
$slots: {
|
65
|
-
default: () => any
|
66
|
-
}
|
67
|
-
|
68
|
-
$emit: {
|
69
|
-
click: (event: MouseEvent) => void
|
70
|
-
}
|
71
|
-
}
|
10
|
+
MButton: MButtonProps
|
72
11
|
}
|
73
12
|
}
|