mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-10-21 23:42:09 +08:00
chore: run linter and fix
This commit is contained in:
parent
63d1f8382f
commit
eeb03ce246
@ -10,7 +10,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node build/dev.js",
|
"dev": "node build/dev.js",
|
||||||
"lint": "eslint ./packages --ext .js,.ts && stylelint \"packages/**/*.less\" --fix",
|
"lint": "eslint ./packages --ext .js,.ts --fix && stylelint \"packages/**/*.less\" --fix",
|
||||||
"release": "sh build/release.sh",
|
"release": "sh build/release.sh",
|
||||||
"release:site": "sh build/release-site.sh",
|
"release:site": "sh build/release-site.sh",
|
||||||
"build:lib": "yarn && npx gulp -f build/compiler.js --series buildEs buildLib",
|
"build:lib": "yarn && npx gulp -f build/compiler.js --series buildEs buildLib",
|
||||||
@ -47,7 +47,7 @@
|
|||||||
"@babel/preset-env": "^7.5.5",
|
"@babel/preset-env": "^7.5.5",
|
||||||
"@vant/cli": "^1.0.3",
|
"@vant/cli": "^1.0.3",
|
||||||
"@vant/doc": "^2.5.5",
|
"@vant/doc": "^2.5.5",
|
||||||
"@vant/eslint-config": "^2.2.0",
|
"@vant/eslint-config": "^2.2.1",
|
||||||
"@vant/icons": "1.2.0",
|
"@vant/icons": "1.2.0",
|
||||||
"@vant/markdown-loader": "^2.3.0",
|
"@vant/markdown-loader": "^2.3.0",
|
||||||
"@vant/stylelint-config": "^1.3.0",
|
"@vant/stylelint-config": "^1.3.0",
|
||||||
|
@ -1,68 +1,69 @@
|
|||||||
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
export namespace Weapp {
|
export namespace Weapp {
|
||||||
export interface FormField {
|
export interface FormField {
|
||||||
data: {
|
data: {
|
||||||
name: string
|
name: string;
|
||||||
value: any
|
value: any;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Target {
|
interface Target {
|
||||||
id: string
|
id: string;
|
||||||
tagName: string
|
tagName: string;
|
||||||
dataset: {
|
dataset: {
|
||||||
[key: string]: any
|
[key: string]: any;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Event {
|
export interface Event {
|
||||||
/**
|
/**
|
||||||
* 代表事件的类型。
|
* 代表事件的类型。
|
||||||
*/
|
*/
|
||||||
type: string
|
type: string;
|
||||||
/**
|
/**
|
||||||
* 页面打开到触发事件所经过的毫秒数。
|
* 页面打开到触发事件所经过的毫秒数。
|
||||||
*/
|
*/
|
||||||
timeStamp: number
|
timeStamp: number;
|
||||||
/**
|
/**
|
||||||
* 触发事件的源组件。
|
* 触发事件的源组件。
|
||||||
*/
|
*/
|
||||||
target: Target
|
target: Target;
|
||||||
/**
|
/**
|
||||||
* 事件绑定的当前组件。
|
* 事件绑定的当前组件。
|
||||||
*/
|
*/
|
||||||
currentTarget: Target
|
currentTarget: Target;
|
||||||
/**
|
/**
|
||||||
* 额外的信息
|
* 额外的信息
|
||||||
*/
|
*/
|
||||||
detail: any
|
detail: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Touch {
|
interface Touch {
|
||||||
/**
|
/**
|
||||||
* 触摸点的标识符
|
* 触摸点的标识符
|
||||||
*/
|
*/
|
||||||
identifier: number
|
identifier: number;
|
||||||
/**
|
/**
|
||||||
* 距离文档左上角的距离,文档的左上角为原点 ,横向为X轴,纵向为Y轴
|
* 距离文档左上角的距离,文档的左上角为原点 ,横向为X轴,纵向为Y轴
|
||||||
*/
|
*/
|
||||||
pageX: number
|
pageX: number;
|
||||||
/**
|
/**
|
||||||
* 距离文档左上角的距离,文档的左上角为原点 ,横向为X轴,纵向为Y轴
|
* 距离文档左上角的距离,文档的左上角为原点 ,横向为X轴,纵向为Y轴
|
||||||
*/
|
*/
|
||||||
pageY: number
|
pageY: number;
|
||||||
/**
|
/**
|
||||||
* 距离页面可显示区域(屏幕除去导航条)左上角距离,横向为X轴,纵向为Y轴
|
* 距离页面可显示区域(屏幕除去导航条)左上角距离,横向为X轴,纵向为Y轴
|
||||||
*/
|
*/
|
||||||
clientX: number
|
clientX: number;
|
||||||
/**
|
/**
|
||||||
* 距离页面可显示区域(屏幕除去导航条)左上角距离,横向为X轴,纵向为Y轴
|
* 距离页面可显示区域(屏幕除去导航条)左上角距离,横向为X轴,纵向为Y轴
|
||||||
*/
|
*/
|
||||||
clientY: number
|
clientY: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TouchEvent extends Event {
|
export interface TouchEvent extends Event {
|
||||||
touches: Array<Touch>
|
touches: Array<Touch>;
|
||||||
changedTouches: Array<Touch>
|
changedTouches: Array<Touch>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,11 +73,20 @@ export namespace Weapp {
|
|||||||
/** 目标组件的相对关系 */
|
/** 目标组件的相对关系 */
|
||||||
type: 'parent' | 'child' | 'ancestor' | 'descendant';
|
type: 'parent' | 'child' | 'ancestor' | 'descendant';
|
||||||
/** 关系生命周期函数,当关系被建立在页面节点树中时触发,触发时机在组件attached生命周期之后 */
|
/** 关系生命周期函数,当关系被建立在页面节点树中时触发,触发时机在组件attached生命周期之后 */
|
||||||
linked?(this: Instance, target: WechatMiniprogram.Component.TrivialInstance): void;
|
linked?(
|
||||||
|
this: Instance,
|
||||||
|
target: WechatMiniprogram.Component.TrivialInstance
|
||||||
|
): void;
|
||||||
/** 关系生命周期函数,当关系在页面节点树中发生改变时触发,触发时机在组件moved生命周期之后 */
|
/** 关系生命周期函数,当关系在页面节点树中发生改变时触发,触发时机在组件moved生命周期之后 */
|
||||||
linkChanged?(this: Instance, target: WechatMiniprogram.Component.TrivialInstance): void;
|
linkChanged?(
|
||||||
|
this: Instance,
|
||||||
|
target: WechatMiniprogram.Component.TrivialInstance
|
||||||
|
): void;
|
||||||
/** 关系生命周期函数,当关系脱离页面节点树时触发,触发时机在组件detached生命周期之后 */
|
/** 关系生命周期函数,当关系脱离页面节点树时触发,触发时机在组件detached生命周期之后 */
|
||||||
unlinked?(this: Instance, target: WechatMiniprogram.Component.TrivialInstance): void;
|
unlinked?(
|
||||||
|
this: Instance,
|
||||||
|
target: WechatMiniprogram.Component.TrivialInstance
|
||||||
|
): void;
|
||||||
/** 如果这一项被设置,则它表示关联的目标节点所应具有的behavior,所有拥有这一behavior的组件节点都会被关联 */
|
/** 如果这一项被设置,则它表示关联的目标节点所应具有的behavior,所有拥有这一behavior的组件节点都会被关联 */
|
||||||
target?: string;
|
target?: string;
|
||||||
}
|
}
|
||||||
@ -88,18 +98,18 @@ export namespace Weapp {
|
|||||||
this: Instance,
|
this: Instance,
|
||||||
newVal: T,
|
newVal: T,
|
||||||
oldVal: T,
|
oldVal: T,
|
||||||
changedPath: Array<string | number>,
|
changedPath: Array<string | number>
|
||||||
) => void;
|
) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* methods定义,miniprogram-api-typings缺少this定义
|
* methods定义,miniprogram-api-typings缺少this定义
|
||||||
*/
|
*/
|
||||||
export interface MethodOption<Instance> {
|
export interface MethodOption<Instance> {
|
||||||
[name: string]: (this: Instance, ...args: any[]) => any
|
[name: string]: (this: Instance, ...args: any[]) => any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ComputedOption<Instance> {
|
export interface ComputedOption<Instance> {
|
||||||
[name: string]: (this: Instance) => any
|
[name: string]: (this: Instance) => any;
|
||||||
}
|
}
|
||||||
|
|
||||||
type PropertyType =
|
type PropertyType =
|
||||||
@ -112,15 +122,20 @@ export namespace Weapp {
|
|||||||
| null;
|
| null;
|
||||||
|
|
||||||
export interface PropertyOption {
|
export interface PropertyOption {
|
||||||
[name: string]: PropertyType | PropertyType[] | {
|
[name: string]:
|
||||||
/** 属性类型 */
|
| PropertyType
|
||||||
type: PropertyType | PropertyType[];
|
| PropertyType[]
|
||||||
/** 属性初始值 */
|
| {
|
||||||
value?: any;
|
/** 属性类型 */
|
||||||
/** 属性值被更改时的响应函数 */
|
type: PropertyType | PropertyType[];
|
||||||
observer?: string | Observer<WechatMiniprogram.Component.TrivialInstance, any>;
|
/** 属性初始值 */
|
||||||
/** 属性的类型(可以指定多个) */
|
value?: any;
|
||||||
optionalTypes?: PropertyType[];
|
/** 属性值被更改时的响应函数 */
|
||||||
}
|
observer?:
|
||||||
|
| string
|
||||||
|
| Observer<WechatMiniprogram.Component.TrivialInstance, any>;
|
||||||
|
/** 属性的类型(可以指定多个) */
|
||||||
|
optionalTypes?: PropertyType[];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ VantComponent({
|
|||||||
if (this.offset > 0) {
|
if (this.offset > 0) {
|
||||||
this.swipeMove(leftWidth);
|
this.swipeMove(leftWidth);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
rightWidth: {
|
rightWidth: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@ -25,19 +25,19 @@ VantComponent({
|
|||||||
if (this.offset < 0) {
|
if (this.offset < 0) {
|
||||||
this.swipeMove(-rightWidth);
|
this.swipeMove(-rightWidth);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
asyncClose: Boolean,
|
asyncClose: Boolean,
|
||||||
name: {
|
name: {
|
||||||
type: [Number, String],
|
type: [Number, String],
|
||||||
value: ''
|
value: '',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mixins: [touch],
|
mixins: [touch],
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
catchMove: false
|
catchMove: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
@ -46,7 +46,7 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
ARRAY = ARRAY.filter(item => item !== this);
|
ARRAY = ARRAY.filter((item) => item !== this);
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@ -57,7 +57,7 @@ VantComponent({
|
|||||||
|
|
||||||
this.$emit('open', {
|
this.$emit('open', {
|
||||||
position,
|
position,
|
||||||
name: this.data.name
|
name: this.data.name,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ VantComponent({
|
|||||||
this.swipeMove(0);
|
this.swipeMove(0);
|
||||||
},
|
},
|
||||||
|
|
||||||
swipeMove(offset: number = 0) {
|
swipeMove(offset = 0) {
|
||||||
this.offset = range(offset, -this.data.rightWidth, this.data.leftWidth);
|
this.offset = range(offset, -this.data.rightWidth, this.data.leftWidth);
|
||||||
|
|
||||||
const transform = `translate3d(${this.offset}px, 0, 0)`;
|
const transform = `translate3d(${this.offset}px, 0, 0)`;
|
||||||
@ -79,7 +79,7 @@ VantComponent({
|
|||||||
-webkit-transition: ${transition};
|
-webkit-transition: ${transition};
|
||||||
transform: ${transform};
|
transform: ${transform};
|
||||||
transition: ${transition};
|
transition: ${transition};
|
||||||
`
|
`,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.dragging = true;
|
this.dragging = true;
|
||||||
ARRAY.filter(item => item !== this).forEach(item => item.close());
|
ARRAY.filter((item) => item !== this).forEach((item) => item.close());
|
||||||
this.setData({ catchMove: true });
|
this.setData({ catchMove: true });
|
||||||
this.swipeMove(this.startOffset + this.deltaX);
|
this.swipeMove(this.startOffset + this.deltaX);
|
||||||
},
|
},
|
||||||
@ -146,11 +146,11 @@ VantComponent({
|
|||||||
this.$emit('close', {
|
this.$emit('close', {
|
||||||
position,
|
position,
|
||||||
instance: this,
|
instance: this,
|
||||||
name: this.data.name
|
name: this.data.name,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.swipeMove(0);
|
this.swipeMove(0);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
@ -992,10 +992,10 @@
|
|||||||
resolved "https://registry.npm.taobao.org/@vant/doc/download/@vant/doc-2.6.1.tgz#667db2ca32cd86f3def452a03c66076c1b97c969"
|
resolved "https://registry.npm.taobao.org/@vant/doc/download/@vant/doc-2.6.1.tgz#667db2ca32cd86f3def452a03c66076c1b97c969"
|
||||||
integrity sha1-Zn2yyjLNhvPe9FKgPGYHbBuXyWk=
|
integrity sha1-Zn2yyjLNhvPe9FKgPGYHbBuXyWk=
|
||||||
|
|
||||||
"@vant/eslint-config@^2.2.0":
|
"@vant/eslint-config@^2.2.1":
|
||||||
version "2.2.0"
|
version "2.2.1"
|
||||||
resolved "https://registry.npm.taobao.org/@vant/eslint-config/download/@vant/eslint-config-2.2.0.tgz#b2802ff85a0b5b0b4e84b3d7825d5c8fff3d62e6"
|
resolved "https://registry.yarnpkg.com/@vant/eslint-config/-/eslint-config-2.2.1.tgz#3a4d492534f694ae2035c75fd6edfd9cc45bcb6a"
|
||||||
integrity sha1-soAv+FoLWwtOhLPXgl1cj/89YuY=
|
integrity sha512-IqzSDsGynKTBi6cOnLbGQUQDY+bM2QZJxc+q14YRGHAbIWMcru7QeyIbjT2Vc94fBF/1gW9OaDj9eFTmSKGvOA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/eslint-plugin" "^2.28.0"
|
"@typescript-eslint/eslint-plugin" "^2.28.0"
|
||||||
"@typescript-eslint/parser" "^2.28.0"
|
"@typescript-eslint/parser" "^2.28.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user