Compare commits

...

3 Commits

Author SHA1 Message Date
dependabot-preview[bot]
ecff423eb6
Upgrade to GitHub-native Dependabot (#4185)
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2021-04-29 21:06:26 +08:00
chenjiahan
51aff18dea types: fix typing issues 2021-04-29 20:56:40 +08:00
chenjiahan
f96bc10158 chore: bump @vant/cli@3.10.3 2021-04-29 20:39:49 +08:00
13 changed files with 38 additions and 21 deletions

11
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
ignore:
- dependency-name: miniprogram-api-typings
versions:
- 3.3.2

View File

@ -38,7 +38,7 @@
},
"homepage": "https://github.com/youzan/vant-weapp#readme",
"devDependencies": {
"@vant/cli": "^3.10.0",
"@vant/cli": "^3.10.3",
"@vant/icons": "1.5.3",
"gulp": "^4.0.2",
"gulp-insert": "^0.5.0",

View File

@ -102,7 +102,7 @@ VantComponent({
onChange(event: WechatMiniprogram.CustomEvent) {
const { index, picker, value } = event.detail;
this.code = value[index].code;
this.setValues().then(() => {
this.setValues()?.then(() => {
this.$emit('change', {
picker,
values: this.parseValues(picker.getValues()),

View File

@ -10,7 +10,7 @@ interface Day {
date: Date;
type: string;
text: number;
bottomInfo: string;
bottomInfo?: string;
}
VantComponent({
@ -125,13 +125,13 @@ VantComponent({
getRangeDayType(day) {
const { currentDate, allowSameDay } = this.data;
if (!Array.isArray(currentDate)) {
return;
return '';
}
const [startDay, endDay] = currentDate;
if (!startDay) {
return;
return '';
}
const compareToStart = compareDay(day, startDay);
@ -157,6 +157,8 @@ VantComponent({
if (compareToStart > 0 && compareToEnd < 0) {
return 'middle';
}
return '';
},
getDayType(day) {
@ -178,6 +180,8 @@ VantComponent({
if (type === 'range') {
return this.getRangeDayType(day);
}
return '';
},
getBottomInfo(type) {

View File

@ -272,7 +272,7 @@ VantComponent({
}
},
select(date, complete) {
select(date, complete?: boolean) {
if (complete && this.data.type === 'range') {
const valid = this.checkRange(date);

View File

@ -68,7 +68,7 @@ VantComponent({
},
methods: {
getContext() {
getContext(): Promise<WechatMiniprogram.CanvasContext> {
const { type, size } = this.data;
if (type === '' || !canIUseCanvas2d()) {
@ -108,7 +108,10 @@ VantComponent({
Object.keys(color)
.sort((a, b) => parseFloat(a) - parseFloat(b))
.map((key) =>
LinearColor.addColorStop(parseFloat(key) / 100, color[key])
LinearColor.addColorStop(
parseFloat(key) / 100,
color[key] as string
)
);
this.hoverColor = LinearColor;
});
@ -118,7 +121,7 @@ VantComponent({
return Promise.resolve();
},
presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) {
presetCanvas(context, strokeStyle, beginAngle, endAngle, fill?: string) {
const { strokeWidth, lineCap, clockwise, size } = this.data;
const position = size / 2;
const radius = position - strokeWidth / 2;

View File

@ -15,7 +15,7 @@ export function nextTick(cb: (...args: any[]) => void) {
}
}
let systemInfo: WechatMiniprogram.GetSystemInfoSyncResult;
let systemInfo: WechatMiniprogram.SystemInfo;
export function getSystemInfoSync() {
if (systemInfo == null) {
systemInfo = wx.getSystemInfoSync();

View File

@ -145,9 +145,8 @@ VantComponent({
const { filter } = this.data;
const results = this.getRanges().map(({ type, range }) => {
let values = times(range[1] - range[0] + 1, (index) => {
let value = range[0] + index;
value = type === 'year' ? `${value}` : padZero(value);
return value;
const value = range[0] + index;
return type === 'year' ? `${value}` : padZero(value);
});
if (filter) {

View File

@ -113,7 +113,7 @@ VantComponent({
: option;
},
setIndex(index: number, userAction: boolean) {
setIndex(index: number, userAction?: boolean) {
const { data } = this;
index = this.adjustIndex(index) || 0;
const offset = -index * data.itemHeight;

View File

@ -89,7 +89,7 @@ VantComponent({
});
},
updateValue(value: number, end: boolean, drag: boolean) {
updateValue(value: number, end?: boolean, drag?: boolean) {
value = this.format(value);
const { min } = this.data;
const width = `${((value - min) * 100) / this.getRange()}%`;

View File

@ -51,7 +51,7 @@ VantComponent({
},
methods: {
onScroll({ scrollTop } = {}) {
onScroll({ scrollTop }: { scrollTop?: number } = {}) {
const { container, offsetTop, disabled } = this.data;
if (disabled) {

View File

@ -82,7 +82,7 @@ VantComponent({
this.setData({ lists, isInCount: lists.length < maxCount });
},
getDetail(index) {
getDetail(index?: number) {
return {
name: this.data.name,
index: index == null ? this.data.fileList.length : index,

View File

@ -2978,10 +2978,10 @@
"@typescript-eslint/types" "4.21.0"
eslint-visitor-keys "^2.0.0"
"@vant/cli@^3.10.0":
version "3.10.2"
resolved "https://registry.yarnpkg.com/@vant/cli/-/cli-3.10.2.tgz#b5766a2ab136694543d86d102168ab981acfadff"
integrity sha512-CF118Co5BAfH/DtH6jrqBNG2v9pErIkC7ps7JZhZb1CYTPb5l5xkEq0GwjCmGcL1UtbQO/3GvPROFbpYtoLDVA==
"@vant/cli@^3.10.3":
version "3.10.3"
resolved "https://registry.nlark.com/@vant/cli/download/@vant/cli-3.10.3.tgz?cache=0&sync_timestamp=1619699867594&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40vant%2Fcli%2Fdownload%2F%40vant%2Fcli-3.10.3.tgz#021d9a136e9be81c5aa51da0fe1ef61410460bf6"
integrity sha1-Ah2aE26b6BxapR2g/h72FBBGC/Y=
dependencies:
"@babel/core" "^7.12.10"
"@babel/preset-env" "^7.12.11"