mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2026-07-07 23:21:08 +08:00
Compare commits
9 Commits
d235ae6574
...
bc3d307c4d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc3d307c4d | ||
|
|
a3117538b3 | ||
|
|
d72580fe7d | ||
|
|
3d1d27641b | ||
|
|
22acb8ddbc | ||
|
|
35d8346647 | ||
|
|
a232ec525f | ||
|
|
35b199f9f6 | ||
|
|
e8ed007d89 |
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);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@ -1,4 +1,25 @@
|
||||
# 更新日志
|
||||
### [v1.10.20](https://github.com/youzan/vant-weapp/compare/v1.10.19...v1.10.20)
|
||||
|
||||
`2023-07-03`
|
||||
|
||||
**Bug Fixes**
|
||||
|
||||
- calendar: 修复无法选择同一天在 range 模式下 [#5451](https://github.com/youzan/vant-weapp/issues/5451)
|
||||
- slider: 修复小数精度丢失问题 [#5444](https://github.com/youzan/vant-weapp/issues/5444)
|
||||
|
||||
**Document**
|
||||
|
||||
- add @inottn and @zhousg to core team [#5453](https://github.com/youzan/vant-weapp/issues/5453)
|
||||
- popup: 修复文档缺失 close-icon-position 属性 [#5389](https://github.com/youzan/vant-weapp/pull/5389)
|
||||
- dialog: 修复示例代码错误问题 [#5389](https://github.com/youzan/vant-weapp/pull/5389)
|
||||
|
||||
**Feature**
|
||||
|
||||
- goods-action-icon: 增加 size 属性 [#5457](https://github.com/youzan/vant-weapp/issues/5457)
|
||||
- goods-action-icon: 增加 info-class 自定义样式类 [#5457](https://github.com/youzan/vant-weapp/issues/5457)
|
||||
- icon: 增加 info-class 自定义样式类 [#5458](https://github.com/youzan/vant-weapp/issues/5458)
|
||||
|
||||
### [v1.10.19](https://github.com/youzan/vant-weapp/compare/v1.10.18...v1.10.19)
|
||||
|
||||
`2023-05-19`
|
||||
|
||||
@ -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);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vant/weapp",
|
||||
"version": "1.10.19",
|
||||
"version": "1.10.20",
|
||||
"author": "vant-ui",
|
||||
"license": "MIT",
|
||||
"miniprogram": "lib",
|
||||
|
||||
@ -211,14 +211,14 @@ VantComponent({
|
||||
|
||||
const [startDay, endDay] = defaultDate || [];
|
||||
|
||||
const startDate = getTime(startDay || now);
|
||||
const start = this.limitDateRange(
|
||||
startDay || now,
|
||||
startDate,
|
||||
minDate,
|
||||
getPrevDay(new Date(maxDate)).getTime()
|
||||
allowSameDay ? startDate : getPrevDay(new Date(maxDate)).getTime()
|
||||
);
|
||||
|
||||
const date = getTime(endDay || now);
|
||||
|
||||
const end = this.limitDateRange(
|
||||
date,
|
||||
allowSameDay ? date : getNextDay(new Date(minDate)).getTime()
|
||||
|
||||
@ -96,6 +96,15 @@ export function toPromise(promiseLike: Promise<unknown> | unknown) {
|
||||
return Promise.resolve(promiseLike);
|
||||
}
|
||||
|
||||
// 浮点数精度处理
|
||||
export function addNumber(num1, num2) {
|
||||
const cardinal = 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<T>() {
|
||||
const pages = getCurrentPages();
|
||||
return pages[pages.length - 1] as T & WechatMiniprogram.Page.TrivialInstance;
|
||||
|
||||
@ -3,7 +3,7 @@ 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],
|
||||
|
||||
@ -12,6 +12,7 @@ VantComponent({
|
||||
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>
|
||||
|
||||
@ -105,6 +105,7 @@ Page({
|
||||
| icon | 图标类型,可选值见`icon`组件 | _string_ | - |
|
||||
| info | 图标右上角提示信息 | _string \| number_ | - |
|
||||
| color `v1.10.15` | 图标颜色 | _string_ | `inherit` |
|
||||
| size | 图标大小,如 20px,2em,默认单位为px | _string \| number_ | - |
|
||||
| url | 点击后跳转的链接地址 | _string_ | - |
|
||||
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | _string_ | `navigateTo` |
|
||||
| id | 标识符 | _string_ | - |
|
||||
@ -167,6 +168,7 @@ Page({
|
||||
| ---------- | ---------- |
|
||||
| icon-class | 图标样式类 |
|
||||
| text-class | 文字样式类 |
|
||||
| info-class `v1.10.20` | 图标右上角文字样式类 |
|
||||
|
||||
### GoodsActionButton 外部样式类
|
||||
|
||||
|
||||
@ -60,6 +60,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<van-icon
|
||||
class="van-goods-action-icon__icon"
|
||||
customClass="icon-class"
|
||||
infoClass="info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="custom-class van-icon van-icon-chat-o"
|
||||
@ -67,7 +68,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
/>
|
||||
</wx-view>
|
||||
</van-icon>
|
||||
@ -125,6 +126,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<van-icon
|
||||
class="van-goods-action-icon__icon"
|
||||
customClass="icon-class"
|
||||
infoClass="info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="custom-class van-icon van-icon-cart-o"
|
||||
@ -132,7 +134,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
/>
|
||||
</wx-view>
|
||||
</van-icon>
|
||||
@ -307,6 +309,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<van-icon
|
||||
class="van-goods-action-icon__icon"
|
||||
customClass="icon-class"
|
||||
infoClass="info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="custom-class van-icon van-icon-chat-o"
|
||||
@ -314,7 +317,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="van-info van-info van-info--dot custom-class"
|
||||
@ -377,6 +380,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<van-icon
|
||||
class="van-goods-action-icon__icon"
|
||||
customClass="icon-class"
|
||||
infoClass="info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="custom-class van-icon van-icon-cart-o"
|
||||
@ -384,7 +388,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="van-info van-info custom-class"
|
||||
@ -447,6 +451,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<van-icon
|
||||
class="van-goods-action-icon__icon"
|
||||
customClass="icon-class"
|
||||
infoClass="info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="custom-class van-icon van-icon-shop-o"
|
||||
@ -454,7 +459,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
/>
|
||||
</wx-view>
|
||||
</van-icon>
|
||||
@ -625,6 +630,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<van-icon
|
||||
class="van-goods-action-icon__icon"
|
||||
customClass="icon-class"
|
||||
infoClass="info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="custom-class van-icon van-icon-chat-o"
|
||||
@ -632,7 +638,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
/>
|
||||
</wx-view>
|
||||
</van-icon>
|
||||
@ -688,6 +694,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<van-icon
|
||||
class="van-goods-action-icon__icon"
|
||||
customClass="icon-class"
|
||||
infoClass="info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="custom-class van-icon van-icon-shop-o"
|
||||
@ -695,7 +702,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
/>
|
||||
</wx-view>
|
||||
</van-icon>
|
||||
@ -866,6 +873,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<van-icon
|
||||
class="van-goods-action-icon__icon"
|
||||
customClass="icon-class"
|
||||
infoClass="info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="custom-class van-icon van-icon-chat-o"
|
||||
@ -873,7 +881,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
/>
|
||||
</wx-view>
|
||||
</van-icon>
|
||||
@ -929,6 +937,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
<van-icon
|
||||
class="van-goods-action-icon__icon"
|
||||
customClass="icon-class"
|
||||
infoClass="info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="custom-class van-icon van-icon-shop-o"
|
||||
@ -936,7 +945,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
/>
|
||||
</wx-view>
|
||||
</van-icon>
|
||||
|
||||
@ -1174,7 +1174,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="van-info van-info van-info--dot custom-class"
|
||||
@ -1216,7 +1216,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="van-info van-info custom-class"
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
| dot | 是否显示图标右上角小红点 | _boolean_ | `false` |
|
||||
| info | 图标右上角文字提示 | _string \| number_ | - |
|
||||
| color | 图标颜色 | _string_ | `inherit` |
|
||||
| size | 图标大小,如 `20px`,`2em`,默认单位为`px` | _string \| number_ | `inherit` |
|
||||
| size `v1.10.20` | 图标大小,如 `20px`,`2em`,默认单位为`px` | _string \| number_ | `inherit` |
|
||||
| custom-style | 自定义样式 | _string_ | - |
|
||||
| class-prefix | 类名前缀 | _string_ | `van-icon` |
|
||||
|
||||
@ -101,6 +101,7 @@
|
||||
| 类名 | 说明 |
|
||||
| ------------ | ------------ |
|
||||
| custom-class | 根节点样式类 |
|
||||
| info-class | 图标右上角文字样式类 |
|
||||
|
||||
## 常见问题
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
|
||||
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) }}"
|
||||
|
||||
@ -199,7 +199,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="van-info van-info van-info--dot custom-class"
|
||||
@ -228,7 +228,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="van-info van-info custom-class"
|
||||
@ -257,7 +257,7 @@ exports[`should render demo and match snapshot 1`] = `
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
customClass="van-icon__info"
|
||||
customClass="van-icon__info info-class"
|
||||
>
|
||||
<wx-view
|
||||
class="van-info van-info custom-class"
|
||||
|
||||
@ -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';
|
||||
|
||||
type SliderValue = number | [number, number];
|
||||
|
||||
@ -238,8 +238,13 @@ VantComponent({
|
||||
},
|
||||
|
||||
format(value: number) {
|
||||
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);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user