mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +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"
|
binderror="bindError"
|
||||||
bindlaunchapp="bindLaunchApp"
|
bindlaunchapp="bindLaunchApp"
|
||||||
bindopensetting="bindOpenSetting"
|
bindopensetting="bindOpenSetting"
|
||||||
lang="{{ item.lang }}"
|
lang="{{ lang }}"
|
||||||
session-from="{{ item.sessionFrom }}"
|
session-from="{{ sessionFrom }}"
|
||||||
send-message-title="{{ item.sendMessageTitle }}"
|
send-message-title="{{ sendMessageTitle }}"
|
||||||
send-message-path="{{ item.sendMessagePath }}"
|
send-message-path="{{ sendMessagePath }}"
|
||||||
send-message-img="{{ item.sendMessageImg }}"
|
send-message-img="{{ sendMessageImg }}"
|
||||||
show-message-card="{{ item.showMessageCard }}"
|
show-message-card="{{ showMessageCard }}"
|
||||||
app-parameter="{{ item.appParameter }}"
|
app-parameter="{{ appParameter }}"
|
||||||
>
|
>
|
||||||
<block wx:if="{{ !item.loading }}">
|
<block wx:if="{{ !item.loading }}">
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
|
5
dist/checkbox/index.js
vendored
5
dist/checkbox/index.js
vendored
@ -13,7 +13,10 @@ VantComponent({
|
|||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
useIconSlot: Boolean,
|
useIconSlot: Boolean,
|
||||||
checkedColor: String,
|
checkedColor: String,
|
||||||
labelPosition: String,
|
labelPosition: {
|
||||||
|
type: String,
|
||||||
|
value: 'right',
|
||||||
|
},
|
||||||
labelDisabled: Boolean,
|
labelDisabled: Boolean,
|
||||||
shape: {
|
shape: {
|
||||||
type: String,
|
type: String,
|
||||||
|
13
dist/checkbox/index.wxml
vendored
13
dist/checkbox/index.wxml
vendored
@ -2,6 +2,13 @@
|
|||||||
<wxs src="./index.wxs" module="computed" />
|
<wxs src="./index.wxs" module="computed" />
|
||||||
|
|
||||||
<view class="van-checkbox custom-class">
|
<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">
|
<view class="van-checkbox__icon-wrap" bindtap="toggle">
|
||||||
<slot wx:if="{{ useIconSlot }}" name="icon" />
|
<slot wx:if="{{ useIconSlot }}" name="icon" />
|
||||||
<van-icon
|
<van-icon
|
||||||
@ -14,7 +21,11 @@
|
|||||||
custom-style="line-height: 1.25em;"
|
custom-style="line-height: 1.25em;"
|
||||||
/>
|
/>
|
||||||
</view>
|
</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 />
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
</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 { BLUE, WHITE } from '../common/color';
|
||||||
import { adaptor } from './canvas';
|
import { VantComponent } from '../common/component';
|
||||||
import { isObj } from '../common/validator';
|
|
||||||
import { getSystemInfoSync } from '../common/utils';
|
import { getSystemInfoSync } from '../common/utils';
|
||||||
|
import { isObj } from '../common/validator';
|
||||||
|
import { canIUseCanvas2d } from '../common/version';
|
||||||
|
import { adaptor } from './canvas';
|
||||||
function format(rate) {
|
function format(rate) {
|
||||||
return Math.min(Math.max(rate, 0), 100);
|
return Math.min(Math.max(rate, 0), 100);
|
||||||
}
|
}
|
||||||
@ -65,7 +66,7 @@ VantComponent({
|
|||||||
methods: {
|
methods: {
|
||||||
getContext() {
|
getContext() {
|
||||||
const { type, size } = this.data;
|
const { type, size } = this.data;
|
||||||
if (type === '') {
|
if (type === '' || !canIUseCanvas2d()) {
|
||||||
const ctx = wx.createCanvasContext('van-circle', this);
|
const ctx = wx.createCanvasContext('van-circle', this);
|
||||||
return Promise.resolve(ctx);
|
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 canIUseAnimate(): boolean;
|
||||||
export declare function canIUseGroupSetData(): boolean;
|
export declare function canIUseGroupSetData(): boolean;
|
||||||
export declare function canIUseNextTick(): 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;
|
return 0;
|
||||||
}
|
}
|
||||||
export function canIUseModel() {
|
function gte(version) {
|
||||||
const system = getSystemInfoSync();
|
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() {
|
export function canIUseFormFieldButton() {
|
||||||
const system = getSystemInfoSync();
|
return gte('2.10.3');
|
||||||
return compareVersion(system.SDKVersion, '2.10.3') >= 0;
|
|
||||||
}
|
}
|
||||||
export function canIUseAnimate() {
|
export function canIUseAnimate() {
|
||||||
const system = getSystemInfoSync();
|
return gte('2.9.0');
|
||||||
return compareVersion(system.SDKVersion, '2.9.0') >= 0;
|
|
||||||
}
|
}
|
||||||
export function canIUseGroupSetData() {
|
export function canIUseGroupSetData() {
|
||||||
const system = getSystemInfoSync();
|
return gte('2.4.0');
|
||||||
return compareVersion(system.SDKVersion, '2.4.0') >= 0;
|
|
||||||
}
|
}
|
||||||
export function canIUseNextTick() {
|
export function canIUseNextTick() {
|
||||||
return wx.canIUse('nextTick');
|
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
|
* @deprecated use beforeClose instead
|
||||||
*/
|
*/
|
||||||
asyncClose?: boolean;
|
asyncClose?: boolean;
|
||||||
beforeClose?: null | (() => Promise<void> | void);
|
beforeClose?: null | ((action: Action) => Promise<void> | void);
|
||||||
businessId?: number;
|
businessId?: number;
|
||||||
sessionFrom?: string;
|
sessionFrom?: string;
|
||||||
overlayStyle?: string;
|
overlayStyle?: string;
|
||||||
|
69
dist/notice-bar/index.js
vendored
69
dist/notice-bar/index.js
vendored
@ -5,11 +5,7 @@ VantComponent({
|
|||||||
text: {
|
text: {
|
||||||
type: String,
|
type: String,
|
||||||
value: '',
|
value: '',
|
||||||
observer() {
|
observer: 'init',
|
||||||
wx.nextTick(() => {
|
|
||||||
this.init();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mode: {
|
mode: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -30,11 +26,7 @@ VantComponent({
|
|||||||
speed: {
|
speed: {
|
||||||
type: Number,
|
type: Number,
|
||||||
value: 50,
|
value: 50,
|
||||||
observer() {
|
observer: 'init',
|
||||||
wx.nextTick(() => {
|
|
||||||
this.init();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
scrollable: {
|
scrollable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -61,34 +53,39 @@ VantComponent({
|
|||||||
destroyed() {
|
destroyed() {
|
||||||
this.timer && clearTimeout(this.timer);
|
this.timer && clearTimeout(this.timer);
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
Promise.all([
|
requestAnimationFrame(() => {
|
||||||
getRect(this, '.van-notice-bar__content'),
|
Promise.all([
|
||||||
getRect(this, '.van-notice-bar__wrap'),
|
getRect(this, '.van-notice-bar__content'),
|
||||||
]).then((rects) => {
|
getRect(this, '.van-notice-bar__wrap'),
|
||||||
const [contentRect, wrapRect] = rects;
|
]).then((rects) => {
|
||||||
if (
|
const [contentRect, wrapRect] = rects;
|
||||||
contentRect == null ||
|
if (
|
||||||
wrapRect == null ||
|
contentRect == null ||
|
||||||
!contentRect.width ||
|
wrapRect == null ||
|
||||||
!wrapRect.width
|
!contentRect.width ||
|
||||||
) {
|
!wrapRect.width
|
||||||
return;
|
) {
|
||||||
}
|
return;
|
||||||
const { speed, scrollable, delay } = this.data;
|
}
|
||||||
if (scrollable || wrapRect.width < contentRect.width) {
|
const { speed, scrollable, delay } = this.data;
|
||||||
const duration = (contentRect.width / speed) * 1000;
|
if (scrollable || wrapRect.width < contentRect.width) {
|
||||||
this.wrapWidth = wrapRect.width;
|
const duration = (contentRect.width / speed) * 1000;
|
||||||
this.contentWidth = contentRect.width;
|
this.wrapWidth = wrapRect.width;
|
||||||
this.duration = duration;
|
this.contentWidth = contentRect.width;
|
||||||
this.animation = wx.createAnimation({
|
this.duration = duration;
|
||||||
duration,
|
this.animation = wx.createAnimation({
|
||||||
timingFunction: 'linear',
|
duration,
|
||||||
delay,
|
timingFunction: 'linear',
|
||||||
});
|
delay,
|
||||||
this.scroll();
|
});
|
||||||
}
|
this.scroll();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
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__wrap">
|
||||||
<view class="van-notice-bar__content {{ !scrollable && !wrapable ? 'van-ellipsis' : '' }}" animation="{{ animationData }}">
|
<view class="van-notice-bar__content {{ !scrollable && !wrapable ? 'van-ellipsis' : '' }}" animation="{{ animationData }}">
|
||||||
{{ text }}
|
{{ text }}
|
||||||
|
<slot wx:if="{{ !text }}"></slot>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
33
dist/stepper/index.js
vendored
33
dist/stepper/index.js
vendored
@ -16,11 +16,7 @@ VantComponent({
|
|||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: null,
|
type: null,
|
||||||
observer(value) {
|
observer: 'observeValue',
|
||||||
if (!equal(value, this.data.currentValue)) {
|
|
||||||
this.setData({ currentValue: this.format(value) });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
integer: {
|
integer: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -64,6 +60,7 @@ VantComponent({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true,
|
value: true,
|
||||||
},
|
},
|
||||||
|
theme: String,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
currentValue: '',
|
currentValue: '',
|
||||||
@ -74,6 +71,12 @@ VantComponent({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
observeValue() {
|
||||||
|
const { value, currentValue } = this.data;
|
||||||
|
if (!equal(value, currentValue)) {
|
||||||
|
this.setData({ currentValue: this.format(value) });
|
||||||
|
}
|
||||||
|
},
|
||||||
check() {
|
check() {
|
||||||
const val = this.format(this.data.currentValue);
|
const val = this.format(this.data.currentValue);
|
||||||
if (!equal(val, this.data.currentValue)) {
|
if (!equal(val, this.data.currentValue)) {
|
||||||
@ -81,18 +84,18 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
isDisabled(type) {
|
isDisabled(type) {
|
||||||
|
const {
|
||||||
|
disabled,
|
||||||
|
disablePlus,
|
||||||
|
disableMinus,
|
||||||
|
currentValue,
|
||||||
|
max,
|
||||||
|
min,
|
||||||
|
} = this.data;
|
||||||
if (type === 'plus') {
|
if (type === 'plus') {
|
||||||
return (
|
return disabled || disablePlus || currentValue >= max;
|
||||||
this.data.disabled ||
|
|
||||||
this.data.disablePlus ||
|
|
||||||
this.data.currentValue >= this.data.max
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return (
|
return disabled || disableMinus || currentValue <= min;
|
||||||
this.data.disabled ||
|
|
||||||
this.data.disableMinus ||
|
|
||||||
this.data.currentValue <= this.data.min
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
onFocus(event) {
|
onFocus(event) {
|
||||||
this.$emit('focus', event.detail);
|
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="../wxs/utils.wxs" module="utils" />
|
||||||
<wxs src="./index.wxs" module="computed" />
|
<wxs src="./index.wxs" module="computed" />
|
||||||
|
|
||||||
<view class="van-stepper custom-class">
|
<view class="{{ utils.bem('stepper', [theme]) }} custom-class">
|
||||||
<view
|
<view
|
||||||
wx:if="{{ showMinus }}"
|
wx:if="{{ showMinus }}"
|
||||||
data-type="minus"
|
data-type="minus"
|
||||||
@ -12,7 +12,9 @@
|
|||||||
bind:tap="onTap"
|
bind:tap="onTap"
|
||||||
bind:touchstart="onTouchStart"
|
bind:touchstart="onTouchStart"
|
||||||
bind:touchend="onTouchEnd"
|
bind:touchend="onTouchEnd"
|
||||||
/>
|
>
|
||||||
|
<slot name="plus" />
|
||||||
|
</view>
|
||||||
<input
|
<input
|
||||||
type="{{ integer ? 'number' : 'digit' }}"
|
type="{{ integer ? 'number' : 'digit' }}"
|
||||||
class="input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
|
class="input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
|
||||||
@ -34,5 +36,7 @@
|
|||||||
bind:tap="onTap"
|
bind:tap="onTap"
|
||||||
bind:touchstart="onTouchStart"
|
bind:touchstart="onTouchStart"
|
||||||
bind:touchend="onTouchEnd"
|
bind:touchend="onTouchEnd"
|
||||||
/>
|
>
|
||||||
|
<slot name="minus" />
|
||||||
|
</view>
|
||||||
</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,
|
disabled: Boolean,
|
||||||
useIconSlot: Boolean,
|
useIconSlot: Boolean,
|
||||||
checkedColor: String,
|
checkedColor: String,
|
||||||
labelPosition: String,
|
labelPosition: {
|
||||||
|
type: String,
|
||||||
|
value: 'right',
|
||||||
|
},
|
||||||
labelDisabled: Boolean,
|
labelDisabled: Boolean,
|
||||||
shape: {
|
shape: {
|
||||||
type: String,
|
type: String,
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
<wxs src="./index.wxs" module="computed" />
|
<wxs src="./index.wxs" module="computed" />
|
||||||
|
|
||||||
<view class="van-checkbox custom-class">
|
<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">
|
<view class="van-checkbox__icon-wrap" bindtap="toggle">
|
||||||
<slot wx:if="{{ useIconSlot }}" name="icon" />
|
<slot wx:if="{{ useIconSlot }}" name="icon" />
|
||||||
<van-icon
|
<van-icon
|
||||||
@ -14,7 +21,11 @@
|
|||||||
custom-style="line-height: 1.25em;"
|
custom-style="line-height: 1.25em;"
|
||||||
/>
|
/>
|
||||||
</view>
|
</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 />
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
var component_1 = require('../common/component');
|
|
||||||
var color_1 = require('../common/color');
|
var color_1 = require('../common/color');
|
||||||
var canvas_1 = require('./canvas');
|
var component_1 = require('../common/component');
|
||||||
var validator_1 = require('../common/validator');
|
|
||||||
var utils_1 = require('../common/utils');
|
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) {
|
function format(rate) {
|
||||||
return Math.min(Math.max(rate, 0), 100);
|
return Math.min(Math.max(rate, 0), 100);
|
||||||
}
|
}
|
||||||
@ -71,7 +72,7 @@ component_1.VantComponent({
|
|||||||
var _a = this.data,
|
var _a = this.data,
|
||||||
type = _a.type,
|
type = _a.type,
|
||||||
size = _a.size;
|
size = _a.size;
|
||||||
if (type === '') {
|
if (type === '' || !version_1.canIUseCanvas2d()) {
|
||||||
var ctx = wx.createCanvasContext('van-circle', this);
|
var ctx = wx.createCanvasContext('van-circle', this);
|
||||||
return Promise.resolve(ctx);
|
return Promise.resolve(ctx);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
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');
|
var utils_1 = require('./utils');
|
||||||
function compareVersion(v1, v2) {
|
function compareVersion(v1, v2) {
|
||||||
v1 = v1.split('.');
|
v1 = v1.split('.');
|
||||||
@ -24,27 +24,31 @@ function compareVersion(v1, v2) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
function canIUseModel() {
|
function gte(version) {
|
||||||
var system = utils_1.getSystemInfoSync();
|
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;
|
exports.canIUseModel = canIUseModel;
|
||||||
function canIUseFormFieldButton() {
|
function canIUseFormFieldButton() {
|
||||||
var system = utils_1.getSystemInfoSync();
|
return gte('2.10.3');
|
||||||
return compareVersion(system.SDKVersion, '2.10.3') >= 0;
|
|
||||||
}
|
}
|
||||||
exports.canIUseFormFieldButton = canIUseFormFieldButton;
|
exports.canIUseFormFieldButton = canIUseFormFieldButton;
|
||||||
function canIUseAnimate() {
|
function canIUseAnimate() {
|
||||||
var system = utils_1.getSystemInfoSync();
|
return gte('2.9.0');
|
||||||
return compareVersion(system.SDKVersion, '2.9.0') >= 0;
|
|
||||||
}
|
}
|
||||||
exports.canIUseAnimate = canIUseAnimate;
|
exports.canIUseAnimate = canIUseAnimate;
|
||||||
function canIUseGroupSetData() {
|
function canIUseGroupSetData() {
|
||||||
var system = utils_1.getSystemInfoSync();
|
return gte('2.4.0');
|
||||||
return compareVersion(system.SDKVersion, '2.4.0') >= 0;
|
|
||||||
}
|
}
|
||||||
exports.canIUseGroupSetData = canIUseGroupSetData;
|
exports.canIUseGroupSetData = canIUseGroupSetData;
|
||||||
function canIUseNextTick() {
|
function canIUseNextTick() {
|
||||||
return wx.canIUse('nextTick');
|
return wx.canIUse('nextTick');
|
||||||
}
|
}
|
||||||
exports.canIUseNextTick = canIUseNextTick;
|
exports.canIUseNextTick = canIUseNextTick;
|
||||||
|
function canIUseCanvas2d() {
|
||||||
|
return gte('2.9.0');
|
||||||
|
}
|
||||||
|
exports.canIUseCanvas2d = canIUseCanvas2d;
|
||||||
|
@ -7,12 +7,7 @@ component_1.VantComponent({
|
|||||||
text: {
|
text: {
|
||||||
type: String,
|
type: String,
|
||||||
value: '',
|
value: '',
|
||||||
observer: function () {
|
observer: 'init',
|
||||||
var _this = this;
|
|
||||||
wx.nextTick(function () {
|
|
||||||
_this.init();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mode: {
|
mode: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -33,12 +28,7 @@ component_1.VantComponent({
|
|||||||
speed: {
|
speed: {
|
||||||
type: Number,
|
type: Number,
|
||||||
value: 50,
|
value: 50,
|
||||||
observer: function () {
|
observer: 'init',
|
||||||
var _this = this;
|
|
||||||
wx.nextTick(function () {
|
|
||||||
_this.init();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
scrollable: {
|
scrollable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -65,39 +55,44 @@ component_1.VantComponent({
|
|||||||
destroyed: function () {
|
destroyed: function () {
|
||||||
this.timer && clearTimeout(this.timer);
|
this.timer && clearTimeout(this.timer);
|
||||||
},
|
},
|
||||||
|
mounted: function () {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init: function () {
|
init: function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
Promise.all([
|
utils_1.requestAnimationFrame(function () {
|
||||||
utils_1.getRect(this, '.van-notice-bar__content'),
|
Promise.all([
|
||||||
utils_1.getRect(this, '.van-notice-bar__wrap'),
|
utils_1.getRect(_this, '.van-notice-bar__content'),
|
||||||
]).then(function (rects) {
|
utils_1.getRect(_this, '.van-notice-bar__wrap'),
|
||||||
var contentRect = rects[0],
|
]).then(function (rects) {
|
||||||
wrapRect = rects[1];
|
var contentRect = rects[0],
|
||||||
if (
|
wrapRect = rects[1];
|
||||||
contentRect == null ||
|
if (
|
||||||
wrapRect == null ||
|
contentRect == null ||
|
||||||
!contentRect.width ||
|
wrapRect == null ||
|
||||||
!wrapRect.width
|
!contentRect.width ||
|
||||||
) {
|
!wrapRect.width
|
||||||
return;
|
) {
|
||||||
}
|
return;
|
||||||
var _a = _this.data,
|
}
|
||||||
speed = _a.speed,
|
var _a = _this.data,
|
||||||
scrollable = _a.scrollable,
|
speed = _a.speed,
|
||||||
delay = _a.delay;
|
scrollable = _a.scrollable,
|
||||||
if (scrollable || wrapRect.width < contentRect.width) {
|
delay = _a.delay;
|
||||||
var duration = (contentRect.width / speed) * 1000;
|
if (scrollable || wrapRect.width < contentRect.width) {
|
||||||
_this.wrapWidth = wrapRect.width;
|
var duration = (contentRect.width / speed) * 1000;
|
||||||
_this.contentWidth = contentRect.width;
|
_this.wrapWidth = wrapRect.width;
|
||||||
_this.duration = duration;
|
_this.contentWidth = contentRect.width;
|
||||||
_this.animation = wx.createAnimation({
|
_this.duration = duration;
|
||||||
duration: duration,
|
_this.animation = wx.createAnimation({
|
||||||
timingFunction: 'linear',
|
duration: duration,
|
||||||
delay: delay,
|
timingFunction: 'linear',
|
||||||
});
|
delay: delay,
|
||||||
_this.scroll();
|
});
|
||||||
}
|
_this.scroll();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
scroll: function () {
|
scroll: function () {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
<view class="van-notice-bar__wrap">
|
<view class="van-notice-bar__wrap">
|
||||||
<view class="van-notice-bar__content {{ !scrollable && !wrapable ? 'van-ellipsis' : '' }}" animation="{{ animationData }}">
|
<view class="van-notice-bar__content {{ !scrollable && !wrapable ? 'van-ellipsis' : '' }}" animation="{{ animationData }}">
|
||||||
{{ text }}
|
{{ text }}
|
||||||
|
<slot wx:if="{{ !text }}"></slot>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -33,11 +33,7 @@ component_1.VantComponent({
|
|||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: null,
|
type: null,
|
||||||
observer: function (value) {
|
observer: 'observeValue',
|
||||||
if (!equal(value, this.data.currentValue)) {
|
|
||||||
this.setData({ currentValue: this.format(value) });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
integer: {
|
integer: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -81,6 +77,7 @@ component_1.VantComponent({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true,
|
value: true,
|
||||||
},
|
},
|
||||||
|
theme: String,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
currentValue: '',
|
currentValue: '',
|
||||||
@ -91,6 +88,14 @@ component_1.VantComponent({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
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 () {
|
check: function () {
|
||||||
var val = this.format(this.data.currentValue);
|
var val = this.format(this.data.currentValue);
|
||||||
if (!equal(val, this.data.currentValue)) {
|
if (!equal(val, this.data.currentValue)) {
|
||||||
@ -98,18 +103,17 @@ component_1.VantComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
isDisabled: function (type) {
|
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') {
|
if (type === 'plus') {
|
||||||
return (
|
return disabled || disablePlus || currentValue >= max;
|
||||||
this.data.disabled ||
|
|
||||||
this.data.disablePlus ||
|
|
||||||
this.data.currentValue >= this.data.max
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return (
|
return disabled || disableMinus || currentValue <= min;
|
||||||
this.data.disabled ||
|
|
||||||
this.data.disableMinus ||
|
|
||||||
this.data.currentValue <= this.data.min
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
onFocus: function (event) {
|
onFocus: function (event) {
|
||||||
this.$emit('focus', event.detail);
|
this.$emit('focus', event.detail);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||||
<wxs src="./index.wxs" module="computed" />
|
<wxs src="./index.wxs" module="computed" />
|
||||||
|
|
||||||
<view class="van-stepper custom-class">
|
<view class="{{ utils.bem('stepper', [theme]) }} custom-class">
|
||||||
<view
|
<view
|
||||||
wx:if="{{ showMinus }}"
|
wx:if="{{ showMinus }}"
|
||||||
data-type="minus"
|
data-type="minus"
|
||||||
@ -12,7 +12,9 @@
|
|||||||
bind:tap="onTap"
|
bind:tap="onTap"
|
||||||
bind:touchstart="onTouchStart"
|
bind:touchstart="onTouchStart"
|
||||||
bind:touchend="onTouchEnd"
|
bind:touchend="onTouchEnd"
|
||||||
/>
|
>
|
||||||
|
<slot name="plus" />
|
||||||
|
</view>
|
||||||
<input
|
<input
|
||||||
type="{{ integer ? 'number' : 'digit' }}"
|
type="{{ integer ? 'number' : 'digit' }}"
|
||||||
class="input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
|
class="input-class {{ utils.bem('stepper__input', { disabled: disabled || disableInput }) }}"
|
||||||
@ -34,5 +36,7 @@
|
|||||||
bind:tap="onTap"
|
bind:tap="onTap"
|
||||||
bind:touchstart="onTouchStart"
|
bind:touchstart="onTouchStart"
|
||||||
bind:touchend="onTouchEnd"
|
bind:touchend="onTouchEnd"
|
||||||
/>
|
>
|
||||||
|
<slot name="minus" />
|
||||||
|
</view>
|
||||||
</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