From 211a525b2cd00200e466c776c7fea0187b56207f Mon Sep 17 00:00:00 2001 From: zhongnan Date: Fri, 26 Feb 2021 17:05:42 +0800 Subject: [PATCH] build: compile 1.6.8 --- dist/action-sheet/index.wxml | 14 +++---- dist/checkbox/index.js | 5 ++- dist/checkbox/index.wxml | 13 +++++- dist/circle/index.js | 9 ++-- dist/common/version.d.ts | 1 + dist/common/version.js | 19 +++++---- dist/dialog/dialog.d.ts | 2 +- dist/notice-bar/index.js | 69 +++++++++++++++---------------- dist/notice-bar/index.wxml | 1 + dist/stepper/index.js | 33 ++++++++------- dist/stepper/index.wxml | 10 +++-- dist/stepper/index.wxss | 2 +- lib/checkbox/index.js | 5 ++- lib/checkbox/index.wxml | 13 +++++- lib/circle/index.js | 9 ++-- lib/common/version.js | 22 ++++++---- lib/notice-bar/index.js | 79 +++++++++++++++++------------------- lib/notice-bar/index.wxml | 1 + lib/stepper/index.js | 34 +++++++++------- lib/stepper/index.wxml | 10 +++-- lib/stepper/index.wxss | 2 +- 21 files changed, 200 insertions(+), 153 deletions(-) diff --git a/dist/action-sheet/index.wxml b/dist/action-sheet/index.wxml index 06e62b25..c2bebcac 100644 --- a/dist/action-sheet/index.wxml +++ b/dist/action-sheet/index.wxml @@ -39,13 +39,13 @@ binderror="bindError" bindlaunchapp="bindLaunchApp" bindopensetting="bindOpenSetting" - lang="{{ item.lang }}" - session-from="{{ item.sessionFrom }}" - send-message-title="{{ item.sendMessageTitle }}" - send-message-path="{{ item.sendMessagePath }}" - send-message-img="{{ item.sendMessageImg }}" - show-message-card="{{ item.showMessageCard }}" - app-parameter="{{ item.appParameter }}" + lang="{{ lang }}" + session-from="{{ sessionFrom }}" + send-message-title="{{ sendMessageTitle }}" + send-message-path="{{ sendMessagePath }}" + send-message-img="{{ sendMessageImg }}" + show-message-card="{{ showMessageCard }}" + app-parameter="{{ appParameter }}" > {{ item.name }} diff --git a/dist/checkbox/index.js b/dist/checkbox/index.js index 3d1acd41..281f69ad 100644 --- a/dist/checkbox/index.js +++ b/dist/checkbox/index.js @@ -13,7 +13,10 @@ VantComponent({ disabled: Boolean, useIconSlot: Boolean, checkedColor: String, - labelPosition: String, + labelPosition: { + type: String, + value: 'right', + }, labelDisabled: Boolean, shape: { type: String, diff --git a/dist/checkbox/index.wxml b/dist/checkbox/index.wxml index 94789d81..0c008d81 100644 --- a/dist/checkbox/index.wxml +++ b/dist/checkbox/index.wxml @@ -2,6 +2,13 @@ + + + - + diff --git a/dist/circle/index.js b/dist/circle/index.js index dd27f52b..c3a2894c 100644 --- a/dist/circle/index.js +++ b/dist/circle/index.js @@ -1,8 +1,9 @@ -import { VantComponent } from '../common/component'; import { BLUE, WHITE } from '../common/color'; -import { adaptor } from './canvas'; -import { isObj } from '../common/validator'; +import { VantComponent } from '../common/component'; import { getSystemInfoSync } from '../common/utils'; +import { isObj } from '../common/validator'; +import { canIUseCanvas2d } from '../common/version'; +import { adaptor } from './canvas'; function format(rate) { return Math.min(Math.max(rate, 0), 100); } @@ -65,7 +66,7 @@ VantComponent({ methods: { getContext() { const { type, size } = this.data; - if (type === '') { + if (type === '' || !canIUseCanvas2d()) { const ctx = wx.createCanvasContext('van-circle', this); return Promise.resolve(ctx); } diff --git a/dist/common/version.d.ts b/dist/common/version.d.ts index 79c0c248..89c4ddd7 100644 --- a/dist/common/version.d.ts +++ b/dist/common/version.d.ts @@ -3,3 +3,4 @@ export declare function canIUseFormFieldButton(): boolean; export declare function canIUseAnimate(): boolean; export declare function canIUseGroupSetData(): boolean; export declare function canIUseNextTick(): boolean; +export declare function canIUseCanvas2d(): boolean; diff --git a/dist/common/version.js b/dist/common/version.js index 9634c504..34d698ee 100644 --- a/dist/common/version.js +++ b/dist/common/version.js @@ -21,22 +21,25 @@ function compareVersion(v1, v2) { } return 0; } -export function canIUseModel() { +function gte(version) { const system = getSystemInfoSync(); - return compareVersion(system.SDKVersion, '2.9.3') >= 0; + return compareVersion(system.SDKVersion, version) >= 0; +} +export function canIUseModel() { + return gte('2.9.3'); } export function canIUseFormFieldButton() { - const system = getSystemInfoSync(); - return compareVersion(system.SDKVersion, '2.10.3') >= 0; + return gte('2.10.3'); } export function canIUseAnimate() { - const system = getSystemInfoSync(); - return compareVersion(system.SDKVersion, '2.9.0') >= 0; + return gte('2.9.0'); } export function canIUseGroupSetData() { - const system = getSystemInfoSync(); - return compareVersion(system.SDKVersion, '2.4.0') >= 0; + return gte('2.4.0'); } export function canIUseNextTick() { return wx.canIUse('nextTick'); } +export function canIUseCanvas2d() { + return gte('2.9.0'); +} diff --git a/dist/dialog/dialog.d.ts b/dist/dialog/dialog.d.ts index ee7f4559..71440326 100644 --- a/dist/dialog/dialog.d.ts +++ b/dist/dialog/dialog.d.ts @@ -21,7 +21,7 @@ interface DialogOptions { * @deprecated use beforeClose instead */ asyncClose?: boolean; - beforeClose?: null | (() => Promise | void); + beforeClose?: null | ((action: Action) => Promise | void); businessId?: number; sessionFrom?: string; overlayStyle?: string; diff --git a/dist/notice-bar/index.js b/dist/notice-bar/index.js index ce37532d..744a7159 100644 --- a/dist/notice-bar/index.js +++ b/dist/notice-bar/index.js @@ -5,11 +5,7 @@ VantComponent({ text: { type: String, value: '', - observer() { - wx.nextTick(() => { - this.init(); - }); - }, + observer: 'init', }, mode: { type: String, @@ -30,11 +26,7 @@ VantComponent({ speed: { type: Number, value: 50, - observer() { - wx.nextTick(() => { - this.init(); - }); - }, + observer: 'init', }, scrollable: { type: Boolean, @@ -61,34 +53,39 @@ VantComponent({ destroyed() { this.timer && clearTimeout(this.timer); }, + mounted() { + this.init(); + }, methods: { init() { - Promise.all([ - getRect(this, '.van-notice-bar__content'), - getRect(this, '.van-notice-bar__wrap'), - ]).then((rects) => { - const [contentRect, wrapRect] = rects; - if ( - contentRect == null || - wrapRect == null || - !contentRect.width || - !wrapRect.width - ) { - return; - } - const { speed, scrollable, delay } = this.data; - if (scrollable || wrapRect.width < contentRect.width) { - const duration = (contentRect.width / speed) * 1000; - this.wrapWidth = wrapRect.width; - this.contentWidth = contentRect.width; - this.duration = duration; - this.animation = wx.createAnimation({ - duration, - timingFunction: 'linear', - delay, - }); - this.scroll(); - } + requestAnimationFrame(() => { + Promise.all([ + getRect(this, '.van-notice-bar__content'), + getRect(this, '.van-notice-bar__wrap'), + ]).then((rects) => { + const [contentRect, wrapRect] = rects; + if ( + contentRect == null || + wrapRect == null || + !contentRect.width || + !wrapRect.width + ) { + return; + } + const { speed, scrollable, delay } = this.data; + if (scrollable || wrapRect.width < contentRect.width) { + const duration = (contentRect.width / speed) * 1000; + this.wrapWidth = wrapRect.width; + this.contentWidth = contentRect.width; + this.duration = duration; + this.animation = wx.createAnimation({ + duration, + timingFunction: 'linear', + delay, + }); + this.scroll(); + } + }); }); }, scroll() { diff --git a/dist/notice-bar/index.wxml b/dist/notice-bar/index.wxml index f16854bf..be119adc 100644 --- a/dist/notice-bar/index.wxml +++ b/dist/notice-bar/index.wxml @@ -18,6 +18,7 @@ {{ text }} + diff --git a/dist/stepper/index.js b/dist/stepper/index.js index 14aae5d5..6ea0da54 100644 --- a/dist/stepper/index.js +++ b/dist/stepper/index.js @@ -16,11 +16,7 @@ VantComponent({ props: { value: { type: null, - observer(value) { - if (!equal(value, this.data.currentValue)) { - this.setData({ currentValue: this.format(value) }); - } - }, + observer: 'observeValue', }, integer: { type: Boolean, @@ -64,6 +60,7 @@ VantComponent({ type: Boolean, value: true, }, + theme: String, }, data: { currentValue: '', @@ -74,6 +71,12 @@ VantComponent({ }); }, methods: { + observeValue() { + const { value, currentValue } = this.data; + if (!equal(value, currentValue)) { + this.setData({ currentValue: this.format(value) }); + } + }, check() { const val = this.format(this.data.currentValue); if (!equal(val, this.data.currentValue)) { @@ -81,18 +84,18 @@ VantComponent({ } }, isDisabled(type) { + const { + disabled, + disablePlus, + disableMinus, + currentValue, + max, + min, + } = this.data; if (type === 'plus') { - return ( - this.data.disabled || - this.data.disablePlus || - this.data.currentValue >= this.data.max - ); + return disabled || disablePlus || currentValue >= max; } - return ( - this.data.disabled || - this.data.disableMinus || - this.data.currentValue <= this.data.min - ); + return disabled || disableMinus || currentValue <= min; }, onFocus(event) { this.$emit('focus', event.detail); diff --git a/dist/stepper/index.wxml b/dist/stepper/index.wxml index eadee98c..b49140e5 100644 --- a/dist/stepper/index.wxml +++ b/dist/stepper/index.wxml @@ -1,7 +1,7 @@ - + + > + + + > + + diff --git a/dist/stepper/index.wxss b/dist/stepper/index.wxss index 5da5b793..e924a2b9 100644 --- a/dist/stepper/index.wxss +++ b/dist/stepper/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__minus,.van-stepper__plus{position:relative;display:inline-block;box-sizing:border-box;margin:1px;vertical-align:middle;border:0;background-color:#f2f3f5;background-color:var(--stepper-background-color,#f2f3f5);color:#323233;color:var(--stepper-button-icon-color,#323233);width:28px;width:var(--stepper-input-height,28px);height:28px;height:var(--stepper-input-height,28px);padding:4px;padding:var(--padding-base,4px)}.van-stepper__minus:before,.van-stepper__plus:before{width:9px;height:1px}.van-stepper__minus:after,.van-stepper__plus:after{width:1px;height:9px}.van-stepper__minus:after,.van-stepper__minus:before,.van-stepper__plus:after,.van-stepper__plus:before{position:absolute;top:0;right:0;bottom:0;left:0;margin:auto;background-color:currentColor;content:""}.van-stepper__minus--hover,.van-stepper__plus--hover{background-color:#e8e8e8;background-color:var(--stepper-active-color,#e8e8e8)}.van-stepper__minus--disabled,.van-stepper__plus--disabled{color:#c8c9cc;color:var(--stepper-button-disabled-icon-color,#c8c9cc)}.van-stepper__minus--disabled,.van-stepper__minus--disabled.van-stepper__minus--hover,.van-stepper__minus--disabled.van-stepper__plus--hover,.van-stepper__plus--disabled,.van-stepper__plus--disabled.van-stepper__minus--hover,.van-stepper__plus--disabled.van-stepper__plus--hover{background-color:#f7f8fa;background-color:var(--stepper-button-disabled-color,#f7f8fa)}.van-stepper__minus{border-radius:4px 0 0 4px;border-radius:var(--stepper-border-radius,4px) 0 0 var(--stepper-border-radius,4px)}.van-stepper__minus:after{display:none}.van-stepper__plus{border-radius:0 4px 4px 0;border-radius:0 var(--stepper-border-radius,4px) var(--stepper-border-radius,4px) 0}.van-stepper__input{display:inline-block;box-sizing:border-box;min-height:0;margin:1px;padding:1px;text-align:center;vertical-align:middle;border:0;border-width:1px 0;border-radius:0;-webkit-appearance:none;font-size:14px;font-size:var(--stepper-input-font-size,14px);color:#323233;color:var(--stepper-input-text-color,#323233);background-color:#f2f3f5;background-color:var(--stepper-background-color,#f2f3f5);width:32px;width:var(--stepper-input-width,32px);height:28px;height:var(--stepper-input-height,28px)}.van-stepper__input--disabled{color:#c8c9cc;color:var(--stepper-input-disabled-text-color,#c8c9cc);background-color:#f2f3f5;background-color:var(--stepper-input-disabled-background-color,#f2f3f5)} \ No newline at end of file +@import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__minus,.van-stepper__plus{position:relative;display:inline-block;box-sizing:border-box;margin:1px;vertical-align:middle;border:0;background-color:#f2f3f5;background-color:var(--stepper-background-color,#f2f3f5);color:#323233;color:var(--stepper-button-icon-color,#323233);width:28px;width:var(--stepper-input-height,28px);height:28px;height:var(--stepper-input-height,28px);padding:4px;padding:var(--padding-base,4px)}.van-stepper__minus:before,.van-stepper__plus:before{width:9px;height:1px}.van-stepper__minus:after,.van-stepper__plus:after{width:1px;height:9px}.van-stepper__minus:empty.van-stepper__minus:after,.van-stepper__minus:empty.van-stepper__minus:before,.van-stepper__minus:empty.van-stepper__plus:after,.van-stepper__minus:empty.van-stepper__plus:before,.van-stepper__plus:empty.van-stepper__minus:after,.van-stepper__plus:empty.van-stepper__minus:before,.van-stepper__plus:empty.van-stepper__plus:after,.van-stepper__plus:empty.van-stepper__plus:before{position:absolute;top:0;right:0;bottom:0;left:0;margin:auto;background-color:currentColor;content:""}.van-stepper__minus--hover,.van-stepper__plus--hover{background-color:#e8e8e8;background-color:var(--stepper-active-color,#e8e8e8)}.van-stepper__minus--disabled,.van-stepper__plus--disabled{color:#c8c9cc;color:var(--stepper-button-disabled-icon-color,#c8c9cc)}.van-stepper__minus--disabled,.van-stepper__minus--disabled.van-stepper__minus--hover,.van-stepper__minus--disabled.van-stepper__plus--hover,.van-stepper__plus--disabled,.van-stepper__plus--disabled.van-stepper__minus--hover,.van-stepper__plus--disabled.van-stepper__plus--hover{background-color:#f7f8fa;background-color:var(--stepper-button-disabled-color,#f7f8fa)}.van-stepper__minus{border-radius:4px 0 0 4px;border-radius:var(--stepper-border-radius,4px) 0 0 var(--stepper-border-radius,4px)}.van-stepper__minus:after{display:none}.van-stepper__plus{border-radius:0 4px 4px 0;border-radius:0 var(--stepper-border-radius,4px) var(--stepper-border-radius,4px) 0}.van-stepper--round .van-stepper__input{background-color:initial!important}.van-stepper--round .van-stepper__minus,.van-stepper--round .van-stepper__plus{border-radius:100%}.van-stepper--round .van-stepper__minus:active,.van-stepper--round .van-stepper__plus:active{opacity:.7}.van-stepper--round .van-stepper__minus--disabled,.van-stepper--round .van-stepper__minus--disabled:active,.van-stepper--round .van-stepper__plus--disabled,.van-stepper--round .van-stepper__plus--disabled:active{opacity:.3}.van-stepper--round .van-stepper__plus{color:#fff;background-color:#ee0a24}.van-stepper--round .van-stepper__minus{color:#ee0a24;background-color:#fff;border:1px solid #ee0a24}.van-stepper__input{display:inline-block;box-sizing:border-box;min-height:0;margin:1px;padding:1px;text-align:center;vertical-align:middle;border:0;border-width:1px 0;border-radius:0;-webkit-appearance:none;font-size:14px;font-size:var(--stepper-input-font-size,14px);color:#323233;color:var(--stepper-input-text-color,#323233);background-color:#f2f3f5;background-color:var(--stepper-background-color,#f2f3f5);width:32px;width:var(--stepper-input-width,32px);height:28px;height:var(--stepper-input-height,28px)}.van-stepper__input--disabled{color:#c8c9cc;color:var(--stepper-input-disabled-text-color,#c8c9cc);background-color:#f2f3f5;background-color:var(--stepper-input-disabled-background-color,#f2f3f5)} \ No newline at end of file diff --git a/lib/checkbox/index.js b/lib/checkbox/index.js index f2097205..7b9598bb 100644 --- a/lib/checkbox/index.js +++ b/lib/checkbox/index.js @@ -15,7 +15,10 @@ component_1.VantComponent({ disabled: Boolean, useIconSlot: Boolean, checkedColor: String, - labelPosition: String, + labelPosition: { + type: String, + value: 'right', + }, labelDisabled: Boolean, shape: { type: String, diff --git a/lib/checkbox/index.wxml b/lib/checkbox/index.wxml index 94789d81..0c008d81 100644 --- a/lib/checkbox/index.wxml +++ b/lib/checkbox/index.wxml @@ -2,6 +2,13 @@ + + + - + diff --git a/lib/circle/index.js b/lib/circle/index.js index 3c465f8e..13b90b32 100644 --- a/lib/circle/index.js +++ b/lib/circle/index.js @@ -1,10 +1,11 @@ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); -var component_1 = require('../common/component'); var color_1 = require('../common/color'); -var canvas_1 = require('./canvas'); -var validator_1 = require('../common/validator'); +var component_1 = require('../common/component'); var utils_1 = require('../common/utils'); +var validator_1 = require('../common/validator'); +var version_1 = require('../common/version'); +var canvas_1 = require('./canvas'); function format(rate) { return Math.min(Math.max(rate, 0), 100); } @@ -71,7 +72,7 @@ component_1.VantComponent({ var _a = this.data, type = _a.type, size = _a.size; - if (type === '') { + if (type === '' || !version_1.canIUseCanvas2d()) { var ctx = wx.createCanvasContext('van-circle', this); return Promise.resolve(ctx); } diff --git a/lib/common/version.js b/lib/common/version.js index ce0fd0df..42f80510 100644 --- a/lib/common/version.js +++ b/lib/common/version.js @@ -1,6 +1,6 @@ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); -exports.canIUseNextTick = exports.canIUseGroupSetData = exports.canIUseAnimate = exports.canIUseFormFieldButton = exports.canIUseModel = void 0; +exports.canIUseCanvas2d = exports.canIUseNextTick = exports.canIUseGroupSetData = exports.canIUseAnimate = exports.canIUseFormFieldButton = exports.canIUseModel = void 0; var utils_1 = require('./utils'); function compareVersion(v1, v2) { v1 = v1.split('.'); @@ -24,27 +24,31 @@ function compareVersion(v1, v2) { } return 0; } -function canIUseModel() { +function gte(version) { var system = utils_1.getSystemInfoSync(); - return compareVersion(system.SDKVersion, '2.9.3') >= 0; + return compareVersion(system.SDKVersion, version) >= 0; +} +function canIUseModel() { + return gte('2.9.3'); } exports.canIUseModel = canIUseModel; function canIUseFormFieldButton() { - var system = utils_1.getSystemInfoSync(); - return compareVersion(system.SDKVersion, '2.10.3') >= 0; + return gte('2.10.3'); } exports.canIUseFormFieldButton = canIUseFormFieldButton; function canIUseAnimate() { - var system = utils_1.getSystemInfoSync(); - return compareVersion(system.SDKVersion, '2.9.0') >= 0; + return gte('2.9.0'); } exports.canIUseAnimate = canIUseAnimate; function canIUseGroupSetData() { - var system = utils_1.getSystemInfoSync(); - return compareVersion(system.SDKVersion, '2.4.0') >= 0; + return gte('2.4.0'); } exports.canIUseGroupSetData = canIUseGroupSetData; function canIUseNextTick() { return wx.canIUse('nextTick'); } exports.canIUseNextTick = canIUseNextTick; +function canIUseCanvas2d() { + return gte('2.9.0'); +} +exports.canIUseCanvas2d = canIUseCanvas2d; diff --git a/lib/notice-bar/index.js b/lib/notice-bar/index.js index 12efdec6..25a8a6d7 100644 --- a/lib/notice-bar/index.js +++ b/lib/notice-bar/index.js @@ -7,12 +7,7 @@ component_1.VantComponent({ text: { type: String, value: '', - observer: function () { - var _this = this; - wx.nextTick(function () { - _this.init(); - }); - }, + observer: 'init', }, mode: { type: String, @@ -33,12 +28,7 @@ component_1.VantComponent({ speed: { type: Number, value: 50, - observer: function () { - var _this = this; - wx.nextTick(function () { - _this.init(); - }); - }, + observer: 'init', }, scrollable: { type: Boolean, @@ -65,39 +55,44 @@ component_1.VantComponent({ destroyed: function () { this.timer && clearTimeout(this.timer); }, + mounted: function () { + this.init(); + }, methods: { init: function () { var _this = this; - Promise.all([ - utils_1.getRect(this, '.van-notice-bar__content'), - utils_1.getRect(this, '.van-notice-bar__wrap'), - ]).then(function (rects) { - var contentRect = rects[0], - wrapRect = rects[1]; - if ( - contentRect == null || - wrapRect == null || - !contentRect.width || - !wrapRect.width - ) { - return; - } - var _a = _this.data, - speed = _a.speed, - scrollable = _a.scrollable, - delay = _a.delay; - if (scrollable || wrapRect.width < contentRect.width) { - var duration = (contentRect.width / speed) * 1000; - _this.wrapWidth = wrapRect.width; - _this.contentWidth = contentRect.width; - _this.duration = duration; - _this.animation = wx.createAnimation({ - duration: duration, - timingFunction: 'linear', - delay: delay, - }); - _this.scroll(); - } + utils_1.requestAnimationFrame(function () { + Promise.all([ + utils_1.getRect(_this, '.van-notice-bar__content'), + utils_1.getRect(_this, '.van-notice-bar__wrap'), + ]).then(function (rects) { + var contentRect = rects[0], + wrapRect = rects[1]; + if ( + contentRect == null || + wrapRect == null || + !contentRect.width || + !wrapRect.width + ) { + return; + } + var _a = _this.data, + speed = _a.speed, + scrollable = _a.scrollable, + delay = _a.delay; + if (scrollable || wrapRect.width < contentRect.width) { + var duration = (contentRect.width / speed) * 1000; + _this.wrapWidth = wrapRect.width; + _this.contentWidth = contentRect.width; + _this.duration = duration; + _this.animation = wx.createAnimation({ + duration: duration, + timingFunction: 'linear', + delay: delay, + }); + _this.scroll(); + } + }); }); }, scroll: function () { diff --git a/lib/notice-bar/index.wxml b/lib/notice-bar/index.wxml index f16854bf..be119adc 100644 --- a/lib/notice-bar/index.wxml +++ b/lib/notice-bar/index.wxml @@ -18,6 +18,7 @@ {{ text }} + diff --git a/lib/stepper/index.js b/lib/stepper/index.js index 04327795..b8b061d6 100644 --- a/lib/stepper/index.js +++ b/lib/stepper/index.js @@ -33,11 +33,7 @@ component_1.VantComponent({ props: { value: { type: null, - observer: function (value) { - if (!equal(value, this.data.currentValue)) { - this.setData({ currentValue: this.format(value) }); - } - }, + observer: 'observeValue', }, integer: { type: Boolean, @@ -81,6 +77,7 @@ component_1.VantComponent({ type: Boolean, value: true, }, + theme: String, }, data: { currentValue: '', @@ -91,6 +88,14 @@ component_1.VantComponent({ }); }, methods: { + observeValue: function () { + var _a = this.data, + value = _a.value, + currentValue = _a.currentValue; + if (!equal(value, currentValue)) { + this.setData({ currentValue: this.format(value) }); + } + }, check: function () { var val = this.format(this.data.currentValue); if (!equal(val, this.data.currentValue)) { @@ -98,18 +103,17 @@ component_1.VantComponent({ } }, isDisabled: function (type) { + var _a = this.data, + disabled = _a.disabled, + disablePlus = _a.disablePlus, + disableMinus = _a.disableMinus, + currentValue = _a.currentValue, + max = _a.max, + min = _a.min; if (type === 'plus') { - return ( - this.data.disabled || - this.data.disablePlus || - this.data.currentValue >= this.data.max - ); + return disabled || disablePlus || currentValue >= max; } - return ( - this.data.disabled || - this.data.disableMinus || - this.data.currentValue <= this.data.min - ); + return disabled || disableMinus || currentValue <= min; }, onFocus: function (event) { this.$emit('focus', event.detail); diff --git a/lib/stepper/index.wxml b/lib/stepper/index.wxml index eadee98c..b49140e5 100644 --- a/lib/stepper/index.wxml +++ b/lib/stepper/index.wxml @@ -1,7 +1,7 @@ - + + > + + + > + + diff --git a/lib/stepper/index.wxss b/lib/stepper/index.wxss index 5da5b793..e924a2b9 100644 --- a/lib/stepper/index.wxss +++ b/lib/stepper/index.wxss @@ -1 +1 @@ -@import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__minus,.van-stepper__plus{position:relative;display:inline-block;box-sizing:border-box;margin:1px;vertical-align:middle;border:0;background-color:#f2f3f5;background-color:var(--stepper-background-color,#f2f3f5);color:#323233;color:var(--stepper-button-icon-color,#323233);width:28px;width:var(--stepper-input-height,28px);height:28px;height:var(--stepper-input-height,28px);padding:4px;padding:var(--padding-base,4px)}.van-stepper__minus:before,.van-stepper__plus:before{width:9px;height:1px}.van-stepper__minus:after,.van-stepper__plus:after{width:1px;height:9px}.van-stepper__minus:after,.van-stepper__minus:before,.van-stepper__plus:after,.van-stepper__plus:before{position:absolute;top:0;right:0;bottom:0;left:0;margin:auto;background-color:currentColor;content:""}.van-stepper__minus--hover,.van-stepper__plus--hover{background-color:#e8e8e8;background-color:var(--stepper-active-color,#e8e8e8)}.van-stepper__minus--disabled,.van-stepper__plus--disabled{color:#c8c9cc;color:var(--stepper-button-disabled-icon-color,#c8c9cc)}.van-stepper__minus--disabled,.van-stepper__minus--disabled.van-stepper__minus--hover,.van-stepper__minus--disabled.van-stepper__plus--hover,.van-stepper__plus--disabled,.van-stepper__plus--disabled.van-stepper__minus--hover,.van-stepper__plus--disabled.van-stepper__plus--hover{background-color:#f7f8fa;background-color:var(--stepper-button-disabled-color,#f7f8fa)}.van-stepper__minus{border-radius:4px 0 0 4px;border-radius:var(--stepper-border-radius,4px) 0 0 var(--stepper-border-radius,4px)}.van-stepper__minus:after{display:none}.van-stepper__plus{border-radius:0 4px 4px 0;border-radius:0 var(--stepper-border-radius,4px) var(--stepper-border-radius,4px) 0}.van-stepper__input{display:inline-block;box-sizing:border-box;min-height:0;margin:1px;padding:1px;text-align:center;vertical-align:middle;border:0;border-width:1px 0;border-radius:0;-webkit-appearance:none;font-size:14px;font-size:var(--stepper-input-font-size,14px);color:#323233;color:var(--stepper-input-text-color,#323233);background-color:#f2f3f5;background-color:var(--stepper-background-color,#f2f3f5);width:32px;width:var(--stepper-input-width,32px);height:28px;height:var(--stepper-input-height,28px)}.van-stepper__input--disabled{color:#c8c9cc;color:var(--stepper-input-disabled-text-color,#c8c9cc);background-color:#f2f3f5;background-color:var(--stepper-input-disabled-background-color,#f2f3f5)} \ No newline at end of file +@import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__minus,.van-stepper__plus{position:relative;display:inline-block;box-sizing:border-box;margin:1px;vertical-align:middle;border:0;background-color:#f2f3f5;background-color:var(--stepper-background-color,#f2f3f5);color:#323233;color:var(--stepper-button-icon-color,#323233);width:28px;width:var(--stepper-input-height,28px);height:28px;height:var(--stepper-input-height,28px);padding:4px;padding:var(--padding-base,4px)}.van-stepper__minus:before,.van-stepper__plus:before{width:9px;height:1px}.van-stepper__minus:after,.van-stepper__plus:after{width:1px;height:9px}.van-stepper__minus:empty.van-stepper__minus:after,.van-stepper__minus:empty.van-stepper__minus:before,.van-stepper__minus:empty.van-stepper__plus:after,.van-stepper__minus:empty.van-stepper__plus:before,.van-stepper__plus:empty.van-stepper__minus:after,.van-stepper__plus:empty.van-stepper__minus:before,.van-stepper__plus:empty.van-stepper__plus:after,.van-stepper__plus:empty.van-stepper__plus:before{position:absolute;top:0;right:0;bottom:0;left:0;margin:auto;background-color:currentColor;content:""}.van-stepper__minus--hover,.van-stepper__plus--hover{background-color:#e8e8e8;background-color:var(--stepper-active-color,#e8e8e8)}.van-stepper__minus--disabled,.van-stepper__plus--disabled{color:#c8c9cc;color:var(--stepper-button-disabled-icon-color,#c8c9cc)}.van-stepper__minus--disabled,.van-stepper__minus--disabled.van-stepper__minus--hover,.van-stepper__minus--disabled.van-stepper__plus--hover,.van-stepper__plus--disabled,.van-stepper__plus--disabled.van-stepper__minus--hover,.van-stepper__plus--disabled.van-stepper__plus--hover{background-color:#f7f8fa;background-color:var(--stepper-button-disabled-color,#f7f8fa)}.van-stepper__minus{border-radius:4px 0 0 4px;border-radius:var(--stepper-border-radius,4px) 0 0 var(--stepper-border-radius,4px)}.van-stepper__minus:after{display:none}.van-stepper__plus{border-radius:0 4px 4px 0;border-radius:0 var(--stepper-border-radius,4px) var(--stepper-border-radius,4px) 0}.van-stepper--round .van-stepper__input{background-color:initial!important}.van-stepper--round .van-stepper__minus,.van-stepper--round .van-stepper__plus{border-radius:100%}.van-stepper--round .van-stepper__minus:active,.van-stepper--round .van-stepper__plus:active{opacity:.7}.van-stepper--round .van-stepper__minus--disabled,.van-stepper--round .van-stepper__minus--disabled:active,.van-stepper--round .van-stepper__plus--disabled,.van-stepper--round .van-stepper__plus--disabled:active{opacity:.3}.van-stepper--round .van-stepper__plus{color:#fff;background-color:#ee0a24}.van-stepper--round .van-stepper__minus{color:#ee0a24;background-color:#fff;border:1px solid #ee0a24}.van-stepper__input{display:inline-block;box-sizing:border-box;min-height:0;margin:1px;padding:1px;text-align:center;vertical-align:middle;border:0;border-width:1px 0;border-radius:0;-webkit-appearance:none;font-size:14px;font-size:var(--stepper-input-font-size,14px);color:#323233;color:var(--stepper-input-text-color,#323233);background-color:#f2f3f5;background-color:var(--stepper-background-color,#f2f3f5);width:32px;width:var(--stepper-input-width,32px);height:28px;height:var(--stepper-input-height,28px)}.van-stepper__input--disabled{color:#c8c9cc;color:var(--stepper-input-disabled-text-color,#c8c9cc);background-color:#f2f3f5;background-color:var(--stepper-input-disabled-background-color,#f2f3f5)} \ No newline at end of file