diff --git a/dist/calendar/index.js b/dist/calendar/index.js index fbc5b6d3..b4c4cb83 100644 --- a/dist/calendar/index.js +++ b/dist/calendar/index.js @@ -64,11 +64,11 @@ VantComponent({ observer: 'reset', }, minDate: { - type: null, + type: Number, value: initialMinDate, }, maxDate: { - type: null, + type: Number, value: initialMaxDate, }, position: { @@ -127,7 +127,7 @@ VantComponent({ }, created() { this.setData({ - currentDate: this.getInitialDate(), + currentDate: this.getInitialDate(this.data.defaultDate), }); }, mounted() { @@ -180,11 +180,11 @@ VantComponent({ const start = this.limitDateRange( startDay || now, minDate, - getPrevDay(maxDate).getTime() + getPrevDay(new Date(maxDate)).getTime() ); const end = this.limitDateRange( endDay || now, - getNextDay(minDate).getTime() + getNextDay(new Date(minDate)).getTime() ); return [start, end]; } diff --git a/dist/checkbox/index.wxss b/dist/checkbox/index.wxss index 62f37d49..b0128379 100644 --- a/dist/checkbox/index.wxss +++ b/dist/checkbox/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-checkbox{display:flex;align-items:center;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox--horizontal{margin-right:12px}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{flex:none}.van-checkbox__icon{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #c8c9cc;border:1px solid var(--checkbox-border-color,#c8c9cc);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#ebedf0;background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:#c8c9cc;border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c8c9cc;color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#323233;color:var(--checkbox-label-color,#323233)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c8c9cc;color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0} \ No newline at end of file +@import '../common/index.wxss';.van-checkbox{display:flex;align-items:center;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox--horizontal{margin-right:12px}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{flex:none}.van-checkbox__icon{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #c8c9cc;border:1px solid var(--checkbox-border-color,#c8c9cc);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#ebedf0;background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:#c8c9cc;border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c8c9cc;color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;padding-left:10px;padding-left:var(--checkbox-label-margin,10px);color:#323233;color:var(--checkbox-label-color,#323233)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c8c9cc;color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0} \ No newline at end of file diff --git a/dist/popup/index.js b/dist/popup/index.js index eb2d43e0..295ee198 100644 --- a/dist/popup/index.js +++ b/dist/popup/index.js @@ -53,6 +53,10 @@ VantComponent({ type: Boolean, value: false, }, + lockScroll: { + type: Boolean, + value: true, + }, }, created() { this.observeClass(); diff --git a/dist/popup/index.wxml b/dist/popup/index.wxml index 0be99d46..ea7d696b 100644 --- a/dist/popup/index.wxml +++ b/dist/popup/index.wxml @@ -8,6 +8,7 @@ custom-style="{{ overlayStyle }}" duration="{{ duration }}" bind:click="onClickOverlay" + lock-scroll="{{ lockScroll }}" /> - + - + diff --git a/dist/sticky/index.js b/dist/sticky/index.js index 23aa7eaa..01f10989 100644 --- a/dist/sticky/index.js +++ b/dist/sticky/index.js @@ -1,5 +1,6 @@ import { getRect } from '../common/utils'; import { VantComponent } from '../common/component'; +import { isDef } from '../common/validator'; import { pageScrollMixin } from '../mixins/page-scroll'; const ROOT_ELEMENT = '.van-sticky'; VantComponent({ @@ -78,6 +79,9 @@ VantComponent({ return; } getRect(this, ROOT_ELEMENT).then((root) => { + if (!isDef(root)) { + return; + } if (offsetTop >= root.top) { this.setDataAfterDiff({ fixed: true, height: root.height }); this.transform = 0; diff --git a/lib/calendar/index.js b/lib/calendar/index.js index 2962b66d..38a84b90 100644 --- a/lib/calendar/index.js +++ b/lib/calendar/index.js @@ -66,11 +66,11 @@ component_1.VantComponent({ observer: 'reset', }, minDate: { - type: null, + type: Number, value: initialMinDate, }, maxDate: { - type: null, + type: Number, value: initialMaxDate, }, position: { @@ -129,7 +129,7 @@ component_1.VantComponent({ }, created: function () { this.setData({ - currentDate: this.getInitialDate(), + currentDate: this.getInitialDate(this.data.defaultDate), }); }, mounted: function () { @@ -200,11 +200,11 @@ component_1.VantComponent({ var start = this.limitDateRange( startDay || now, minDate, - utils_1.getPrevDay(maxDate).getTime() + utils_1.getPrevDay(new Date(maxDate)).getTime() ); var end = this.limitDateRange( endDay || now, - utils_1.getNextDay(minDate).getTime() + utils_1.getNextDay(new Date(minDate)).getTime() ); return [start, end]; } diff --git a/lib/checkbox/index.wxss b/lib/checkbox/index.wxss index 62f37d49..b0128379 100644 --- a/lib/checkbox/index.wxss +++ b/lib/checkbox/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-checkbox{display:flex;align-items:center;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox--horizontal{margin-right:12px}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{flex:none}.van-checkbox__icon{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #c8c9cc;border:1px solid var(--checkbox-border-color,#c8c9cc);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#ebedf0;background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:#c8c9cc;border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c8c9cc;color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#323233;color:var(--checkbox-label-color,#323233)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c8c9cc;color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0} \ No newline at end of file +@import '../common/index.wxss';.van-checkbox{display:flex;align-items:center;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox--horizontal{margin-right:12px}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{flex:none}.van-checkbox__icon{display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #c8c9cc;border:1px solid var(--checkbox-border-color,#c8c9cc);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#ebedf0;background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:#c8c9cc;border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c8c9cc;color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;padding-left:10px;padding-left:var(--checkbox-label-margin,10px);color:#323233;color:var(--checkbox-label-color,#323233)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c8c9cc;color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0} \ No newline at end of file diff --git a/lib/popup/index.js b/lib/popup/index.js index fbe673cd..7d819a47 100644 --- a/lib/popup/index.js +++ b/lib/popup/index.js @@ -55,6 +55,10 @@ component_1.VantComponent({ type: Boolean, value: false, }, + lockScroll: { + type: Boolean, + value: true, + }, }, created: function () { this.observeClass(); diff --git a/lib/popup/index.wxml b/lib/popup/index.wxml index 0be99d46..ea7d696b 100644 --- a/lib/popup/index.wxml +++ b/lib/popup/index.wxml @@ -8,6 +8,7 @@ custom-style="{{ overlayStyle }}" duration="{{ duration }}" bind:click="onClickOverlay" + lock-scroll="{{ lockScroll }}" /> - + - + diff --git a/lib/sticky/index.js b/lib/sticky/index.js index c2a1e0b9..3bb20a4f 100644 --- a/lib/sticky/index.js +++ b/lib/sticky/index.js @@ -2,6 +2,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); var utils_1 = require('../common/utils'); var component_1 = require('../common/component'); +var validator_1 = require('../common/validator'); var page_scroll_1 = require('../mixins/page-scroll'); var ROOT_ELEMENT = '.van-sticky'; component_1.VantComponent({ @@ -88,6 +89,9 @@ component_1.VantComponent({ return; } utils_1.getRect(this, ROOT_ELEMENT).then(function (root) { + if (!validator_1.isDef(root)) { + return; + } if (offsetTop >= root.top) { _this.setDataAfterDiff({ fixed: true, height: root.height }); _this.transform = 0;