mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[type] add type definition (#590)
This commit is contained in:
parent
8ab1933829
commit
916d467ab6
@ -1,8 +1,13 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
"noImplicitUseStrict": true
|
"noImplicitUseStrict": true
|
||||||
},
|
},
|
||||||
"files": ["packages/**/*"]
|
"include": [
|
||||||
|
"types/**/*",
|
||||||
|
"packages/**/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
23
types/index.d.ts
vendored
Normal file
23
types/index.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
type Mixins = any[];
|
||||||
|
type Relations = object;
|
||||||
|
type ExternalClasses = string[];
|
||||||
|
|
||||||
|
export interface Vue {
|
||||||
|
$emit(name: string, detail?: any): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type VantComponentOptions<Props, Data, Methods> = {
|
||||||
|
data?: Data;
|
||||||
|
props?: Props;
|
||||||
|
field?: boolean;
|
||||||
|
mixins?: Mixins;
|
||||||
|
relations?: Relations;
|
||||||
|
classes?: ExternalClasses;
|
||||||
|
methods?: Methods & ThisType<Vue & Weapp.Component & { data: Data & Props } & Methods>;
|
||||||
|
|
||||||
|
// lifetimes
|
||||||
|
beforeCreate?: () => void;
|
||||||
|
created?: () => void;
|
||||||
|
mounted?: () => void;
|
||||||
|
destroyed?: () => void;
|
||||||
|
}
|
38
types/weapp.d.ts
vendored
Normal file
38
types/weapp.d.ts
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
declare function Component(options: any): void;
|
||||||
|
|
||||||
|
declare namespace Weapp {
|
||||||
|
interface Component {
|
||||||
|
getRelationNodes(selector: string): any[];
|
||||||
|
setData(data: any, callback?: Function): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Target {
|
||||||
|
id: string;
|
||||||
|
tagName: string;
|
||||||
|
dataset: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Event {
|
||||||
|
type: string;
|
||||||
|
timeStamp: number;
|
||||||
|
target: Target;
|
||||||
|
currentTarget: Target;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Touch {
|
||||||
|
identifier: number;
|
||||||
|
pageX: number;
|
||||||
|
pageY: number;
|
||||||
|
clientX: number;
|
||||||
|
clientY: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TouchEvent extends Event {
|
||||||
|
touches: Array<Touch>;
|
||||||
|
changedTouches: Array<Touch>;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CustomEvent extends Event {
|
||||||
|
detail: any;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user