mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-05 19:41:45 +08:00
build: compile 1.6.8
This commit is contained in:
parent
f9d067e0e8
commit
211a525b2c
14
dist/action-sheet/index.wxml
vendored
14
dist/action-sheet/index.wxml
vendored
@ -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 }}"
|
||||
>
|
||||
<block wx:if="{{ !item.loading }}">
|
||||
{{ item.name }}
|
||||
|
5
dist/checkbox/index.js
vendored
5
dist/checkbox/index.js
vendored
@ -13,7 +13,10 @@ VantComponent({
|
||||
disabled: Boolean,
|
||||
useIconSlot: Boolean,
|
||||
checkedColor: String,
|
||||
labelPosition: String,
|
||||
labelPosition: {
|
||||
type: String,
|
||||
value: 'right',
|
||||
},
|
||||
labelDisabled: Boolean,
|
||||
shape: {
|
||||
type: String,
|
||||
|
13
dist/checkbox/index.wxml
vendored
13
dist/checkbox/index.wxml
vendored
@ -2,6 +2,13 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view class="van-checkbox custom-class">
|
||||
<view
|
||||
wx:if="{{ labelPosition === 'left' }}"
|
||||
class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}"
|
||||
bindtap="onClickLabel"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
<view class="van-checkbox__icon-wrap" bindtap="toggle">
|
||||
<slot wx:if="{{ useIconSlot }}" name="icon" />
|
||||
<van-icon
|
||||
@ -14,7 +21,11 @@
|
||||
custom-style="line-height: 1.25em;"
|
||||
/>
|
||||
</view>
|
||||
<view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" bindtap="onClickLabel">
|
||||
<view
|
||||
wx:if="{{ labelPosition === 'right' }}"
|
||||
class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}"
|
||||
bindtap="onClickLabel"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
|
9
dist/circle/index.js
vendored
9
dist/circle/index.js
vendored
@ -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);
|
||||
}
|
||||
|
1
dist/common/version.d.ts
vendored
1
dist/common/version.d.ts
vendored
@ -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;
|
||||
|
19
dist/common/version.js
vendored
19
dist/common/version.js
vendored
@ -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');
|
||||
}
|
||||
|
2
dist/dialog/dialog.d.ts
vendored
2
dist/dialog/dialog.d.ts
vendored
@ -21,7 +21,7 @@ interface DialogOptions {
|
||||
* @deprecated use beforeClose instead
|
||||
*/
|
||||
asyncClose?: boolean;
|
||||
beforeClose?: null | (() => Promise<void> | void);
|
||||
beforeClose?: null | ((action: Action) => Promise<void> | void);
|
||||
businessId?: number;
|
||||
sessionFrom?: string;
|
||||
overlayStyle?: string;
|
||||
|
69
dist/notice-bar/index.js
vendored
69
dist/notice-bar/index.js
vendored
@ -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() {
|
||||
|
1
dist/notice-bar/index.wxml
vendored
1
dist/notice-bar/index.wxml
vendored
@ -18,6 +18,7 @@
|
||||
<view class="van-notice-bar__wrap">
|
||||
<view class="van-notice-bar__content {{ !scrollable && !wrapable ? 'van-ellipsis' : '' }}" animation="{{ animationData }}">
|
||||
{{ text }}
|
||||
<slot wx:if="{{ !text }}"></slot>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
33
dist/stepper/index.js
vendored
33
dist/stepper/index.js
vendored
@ -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);
|
||||
|
10
dist/stepper/index.wxml
vendored
10
dist/stepper/index.wxml
vendored
@ -1,7 +1,7 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view class="van-stepper custom-class">
|
||||
<view class="{{ utils.bem('stepper', [theme]) }} custom-class">
|
||||
<view
|
||||
wx:if="{{ showMinus }}"
|
||||
data-type="minus"
|
||||
@ -12,7 +12,9 @@
|
||||
bind:tap="onTap"
|
||||
bind:touchstart="onTouchStart"
|
||||
bind:touchend="onTouchEnd"
|
||||
/>
|
||||
>
|
||||
<slot name="plus" />
|
||||
</view>
|
||||
<input
|
||||
type="{{ integer ? 'number' : 'digit' }}"
|
||||
class="input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
|
||||
@ -34,5 +36,7 @@
|
||||
bind:tap="onTap"
|
||||
bind:touchstart="onTouchStart"
|
||||
bind:touchend="onTouchEnd"
|
||||
/>
|
||||
>
|
||||
<slot name="minus" />
|
||||
</view>
|
||||
</view>
|
||||
|
2
dist/stepper/index.wxss
vendored
2
dist/stepper/index.wxss
vendored
@ -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)}
|
||||
@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)}
|
@ -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,
|
||||
|
@ -2,6 +2,13 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view class="van-checkbox custom-class">
|
||||
<view
|
||||
wx:if="{{ labelPosition === 'left' }}"
|
||||
class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}"
|
||||
bindtap="onClickLabel"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
<view class="van-checkbox__icon-wrap" bindtap="toggle">
|
||||
<slot wx:if="{{ useIconSlot }}" name="icon" />
|
||||
<van-icon
|
||||
@ -14,7 +21,11 @@
|
||||
custom-style="line-height: 1.25em;"
|
||||
/>
|
||||
</view>
|
||||
<view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" bindtap="onClickLabel">
|
||||
<view
|
||||
wx:if="{{ labelPosition === 'right' }}"
|
||||
class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}"
|
||||
bindtap="onClickLabel"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 () {
|
||||
|
@ -18,6 +18,7 @@
|
||||
<view class="van-notice-bar__wrap">
|
||||
<view class="van-notice-bar__content {{ !scrollable && !wrapable ? 'van-ellipsis' : '' }}" animation="{{ animationData }}">
|
||||
{{ text }}
|
||||
<slot wx:if="{{ !text }}"></slot>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
@ -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);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view class="van-stepper custom-class">
|
||||
<view class="{{ utils.bem('stepper', [theme]) }} custom-class">
|
||||
<view
|
||||
wx:if="{{ showMinus }}"
|
||||
data-type="minus"
|
||||
@ -12,7 +12,9 @@
|
||||
bind:tap="onTap"
|
||||
bind:touchstart="onTouchStart"
|
||||
bind:touchend="onTouchEnd"
|
||||
/>
|
||||
>
|
||||
<slot name="plus" />
|
||||
</view>
|
||||
<input
|
||||
type="{{ integer ? 'number' : 'digit' }}"
|
||||
class="input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
|
||||
@ -34,5 +36,7 @@
|
||||
bind:tap="onTap"
|
||||
bind:touchstart="onTouchStart"
|
||||
bind:touchend="onTouchEnd"
|
||||
/>
|
||||
>
|
||||
<slot name="minus" />
|
||||
</view>
|
||||
</view>
|
||||
|
@ -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)}
|
||||
@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)}
|
Loading…
x
Reference in New Issue
Block a user