mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 10:22:44 +08:00
build: compile 1.10.20
This commit is contained in:
parent
3d1d27641b
commit
d72580fe7d
3
dist/calendar/index.js
vendored
3
dist/calendar/index.js
vendored
@ -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];
|
||||
|
2
dist/common/utils.d.ts
vendored
2
dist/common/utils.d.ts
vendored
@ -14,4 +14,6 @@ export declare function getRect(context: WechatMiniprogram.Component.TrivialInst
|
||||
export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>;
|
||||
export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void;
|
||||
export declare function toPromise(promiseLike: Promise<unknown> | unknown): Promise<unknown>;
|
||||
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>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject;
|
||||
|
7
dist/common/utils.js
vendored
7
dist/common/utils.js
vendored
@ -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];
|
||||
|
3
dist/goods-action-icon/index.js
vendored
3
dist/goods-action-icon/index.js
vendored
@ -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,
|
||||
|
2
dist/goods-action-icon/index.wxml
vendored
2
dist/goods-action-icon/index.wxml
vendored
@ -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"
|
||||
/>
|
||||
<slot wx:else name="icon" />
|
||||
<text class="text-class">{{ text }}</text>
|
||||
|
1
dist/icon/index.js
vendored
1
dist/icon/index.js
vendored
@ -1,5 +1,6 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
classes: ['info-class'],
|
||||
props: {
|
||||
dot: Boolean,
|
||||
info: null,
|
||||
|
2
dist/icon/index.wxml
vendored
2
dist/icon/index.wxml
vendored
@ -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"
|
||||
/>
|
||||
<image
|
||||
wx:if="{{ computed.isImage(name) }}"
|
||||
|
10
dist/slider/index.js
vendored
10
dist/slider/index.js
vendored
@ -1,7 +1,7 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { touch } from '../mixins/touch';
|
||||
import { canIUseModel } from '../common/version';
|
||||
import { getRect, addUnit, nextTick } from '../common/utils';
|
||||
import { getRect, addUnit, nextTick, addNumber, clamp } from '../common/utils';
|
||||
const DRAG_STATUS = {
|
||||
START: 'start',
|
||||
MOVING: 'moving',
|
||||
@ -196,8 +196,12 @@ VantComponent({
|
||||
return '0%';
|
||||
},
|
||||
format(value) {
|
||||
const { max, min, step } = this.data;
|
||||
return Math.round(Math.max(min, Math.min(value, max)) / step) * step;
|
||||
const min = +this.data.min;
|
||||
const max = +this.data.max;
|
||||
const step = +this.data.step;
|
||||
value = clamp(value, min, max);
|
||||
const diff = Math.round((value - min) / step) * step;
|
||||
return addNumber(min, diff);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -191,7 +191,8 @@ var getTime = function (date) {
|
||||
defaultDate = [];
|
||||
}
|
||||
var _b = defaultDate || [], startDay = _b[0], endDay = _b[1];
|
||||
var start = this.limitDateRange(startDay || now, minDate, (0, utils_1.getPrevDay)(new Date(maxDate)).getTime());
|
||||
var startDate = getTime(startDay || now);
|
||||
var start = this.limitDateRange(startDate, minDate, allowSameDay ? startDate : (0, utils_1.getPrevDay)(new Date(maxDate)).getTime());
|
||||
var date = getTime(endDay || now);
|
||||
var end = this.limitDateRange(date, allowSameDay ? date : (0, utils_1.getNextDay)(new Date(minDate)).getTime());
|
||||
return [start, end];
|
||||
|
2
lib/common/utils.d.ts
vendored
2
lib/common/utils.d.ts
vendored
@ -14,4 +14,6 @@ export declare function getRect(context: WechatMiniprogram.Component.TrivialInst
|
||||
export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>;
|
||||
export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void;
|
||||
export declare function toPromise(promiseLike: Promise<unknown> | unknown): Promise<unknown>;
|
||||
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>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject;
|
||||
|
@ -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];
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
/>
|
||||
<slot wx:else name="icon" />
|
||||
<text class="text-class">{{ text }}</text>
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
/>
|
||||
<image
|
||||
wx:if="{{ computed.isImage(name) }}"
|
||||
|
@ -195,8 +195,12 @@ var DRAG_STATUS = {
|
||||
return '0%';
|
||||
},
|
||||
format: function (value) {
|
||||
var _a = this.data, max = _a.max, min = _a.min, step = _a.step;
|
||||
return Math.round(Math.max(min, Math.min(value, max)) / step) * step;
|
||||
var min = +this.data.min;
|
||||
var max = +this.data.max;
|
||||
var step = +this.data.step;
|
||||
value = (0, utils_1.clamp)(value, min, max);
|
||||
var diff = Math.round((value - min) / step) * step;
|
||||
return (0, utils_1.addNumber)(min, diff);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user