diff --git a/dist/calendar/index.js b/dist/calendar/index.js index 8bdc6bbd..0d2c61a7 100644 --- a/dist/calendar/index.js +++ b/dist/calendar/index.js @@ -170,7 +170,8 @@ VantComponent({ defaultDate = []; } const [startDay, endDay] = defaultDate || []; - const start = this.limitDateRange(startDay || now, minDate, getPrevDay(new Date(maxDate)).getTime()); + const startDate = getTime(startDay || now); + const start = this.limitDateRange(startDate, minDate, allowSameDay ? startDate : getPrevDay(new Date(maxDate)).getTime()); const date = getTime(endDay || now); const end = this.limitDateRange(date, allowSameDay ? date : getNextDay(new Date(minDate)).getTime()); return [start, end]; diff --git a/dist/common/utils.d.ts b/dist/common/utils.d.ts index 719f2ed7..0f3bc874 100644 --- a/dist/common/utils.d.ts +++ b/dist/common/utils.d.ts @@ -14,4 +14,6 @@ export declare function getRect(context: WechatMiniprogram.Component.TrivialInst export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise; export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void; export declare function toPromise(promiseLike: Promise | unknown): Promise; +export declare function addNumber(num1: any, num2: any): number; +export declare const clamp: (num: any, min: any, max: any) => number; export declare function getCurrentPage(): T & WechatMiniprogram.OptionalInterface & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods & WechatMiniprogram.Page.Data & WechatMiniprogram.IAnyObject; diff --git a/dist/common/utils.js b/dist/common/utils.js index f81f5f4e..78afc950 100644 --- a/dist/common/utils.js +++ b/dist/common/utils.js @@ -70,6 +70,13 @@ export function toPromise(promiseLike) { } return Promise.resolve(promiseLike); } +// 浮点数精度处理 +export function addNumber(num1, num2) { + const cardinal = Math.pow(10, 10); + return Math.round((num1 + num2) * cardinal) / cardinal; +} +// 限制value在[min, max]之间 +export const clamp = (num, min, max) => Math.min(Math.max(num, min), max); export function getCurrentPage() { const pages = getCurrentPages(); return pages[pages.length - 1]; diff --git a/dist/goods-action-icon/index.js b/dist/goods-action-icon/index.js index fae0f548..98ed74f9 100644 --- a/dist/goods-action-icon/index.js +++ b/dist/goods-action-icon/index.js @@ -2,13 +2,14 @@ import { VantComponent } from '../common/component'; import { button } from '../mixins/button'; import { link } from '../mixins/link'; VantComponent({ - classes: ['icon-class', 'text-class'], + classes: ['icon-class', 'text-class', 'info-class'], mixins: [link, button], props: { text: String, dot: Boolean, info: String, icon: String, + size: String, color: String, classPrefix: { type: String, diff --git a/dist/goods-action-icon/index.wxml b/dist/goods-action-icon/index.wxml index eb31610d..d43c5673 100644 --- a/dist/goods-action-icon/index.wxml +++ b/dist/goods-action-icon/index.wxml @@ -27,10 +27,12 @@ name="{{ icon }}" dot="{{ dot }}" info="{{ info }}" + size="{{ size }}" color="{{ color }}" class-prefix="{{ classPrefix }}" class="van-goods-action-icon__icon" custom-class="icon-class" + info-class="info-class" /> {{ text }} diff --git a/dist/icon/index.js b/dist/icon/index.js index 34fee338..01c9073d 100644 --- a/dist/icon/index.js +++ b/dist/icon/index.js @@ -1,5 +1,6 @@ import { VantComponent } from '../common/component'; VantComponent({ + classes: ['info-class'], props: { dot: Boolean, info: null, diff --git a/dist/icon/index.wxml b/dist/icon/index.wxml index 3c701745..91b47f91 100644 --- a/dist/icon/index.wxml +++ b/dist/icon/index.wxml @@ -9,7 +9,7 @@ wx:if="{{ info !== null || dot }}" dot="{{ dot }}" info="{{ info }}" - custom-class="van-icon__info" + custom-class="van-icon__info info-class" /> ; export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void; export declare function toPromise(promiseLike: Promise | unknown): Promise; +export declare function addNumber(num1: any, num2: any): number; +export declare const clamp: (num: any, min: any, max: any) => number; export declare function getCurrentPage(): T & WechatMiniprogram.OptionalInterface & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods & WechatMiniprogram.Page.Data & WechatMiniprogram.IAnyObject; diff --git a/lib/common/utils.js b/lib/common/utils.js index 1e35ad27..c5e4ced7 100644 --- a/lib/common/utils.js +++ b/lib/common/utils.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getCurrentPage = exports.toPromise = exports.groupSetData = exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.nextTick = exports.range = exports.getSystemInfoSync = exports.isDef = void 0; +exports.getCurrentPage = exports.clamp = exports.addNumber = exports.toPromise = exports.groupSetData = exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.nextTick = exports.range = exports.getSystemInfoSync = exports.isDef = void 0; var validator_1 = require("./validator"); var version_1 = require("./version"); var validator_2 = require("./validator"); @@ -90,6 +90,15 @@ function toPromise(promiseLike) { return Promise.resolve(promiseLike); } exports.toPromise = toPromise; +// 浮点数精度处理 +function addNumber(num1, num2) { + var cardinal = Math.pow(10, 10); + return Math.round((num1 + num2) * cardinal) / cardinal; +} +exports.addNumber = addNumber; +// 限制value在[min, max]之间 +var clamp = function (num, min, max) { return Math.min(Math.max(num, min), max); }; +exports.clamp = clamp; function getCurrentPage() { var pages = getCurrentPages(); return pages[pages.length - 1]; diff --git a/lib/goods-action-icon/index.js b/lib/goods-action-icon/index.js index b11afb98..828e1f5e 100644 --- a/lib/goods-action-icon/index.js +++ b/lib/goods-action-icon/index.js @@ -4,13 +4,14 @@ var component_1 = require("../common/component"); var button_1 = require("../mixins/button"); var link_1 = require("../mixins/link"); (0, component_1.VantComponent)({ - classes: ['icon-class', 'text-class'], + classes: ['icon-class', 'text-class', 'info-class'], mixins: [link_1.link, button_1.button], props: { text: String, dot: Boolean, info: String, icon: String, + size: String, color: String, classPrefix: { type: String, diff --git a/lib/goods-action-icon/index.wxml b/lib/goods-action-icon/index.wxml index eb31610d..d43c5673 100644 --- a/lib/goods-action-icon/index.wxml +++ b/lib/goods-action-icon/index.wxml @@ -27,10 +27,12 @@ name="{{ icon }}" dot="{{ dot }}" info="{{ info }}" + size="{{ size }}" color="{{ color }}" class-prefix="{{ classPrefix }}" class="van-goods-action-icon__icon" custom-class="icon-class" + info-class="info-class" /> {{ text }} diff --git a/lib/icon/index.js b/lib/icon/index.js index 103b11ee..6758092d 100644 --- a/lib/icon/index.js +++ b/lib/icon/index.js @@ -2,6 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = require("../common/component"); (0, component_1.VantComponent)({ + classes: ['info-class'], props: { dot: Boolean, info: null, diff --git a/lib/icon/index.wxml b/lib/icon/index.wxml index 3c701745..91b47f91 100644 --- a/lib/icon/index.wxml +++ b/lib/icon/index.wxml @@ -9,7 +9,7 @@ wx:if="{{ info !== null || dot }}" dot="{{ dot }}" info="{{ info }}" - custom-class="van-icon__info" + custom-class="van-icon__info info-class" />