build: compile 1.0.0-beta.1

This commit is contained in:
rex-zsd 2019-09-29 11:58:44 +08:00
parent b7296af46f
commit 91dcf68558
77 changed files with 433 additions and 277 deletions

View File

@ -1,11 +1,13 @@
import { VantComponent } from '../common/component';
import { safeArea } from '../mixins/safe-area';
VantComponent({
mixins: [safeArea()],
props: {
show: Boolean,
title: String,
cancelText: String,
round: {
type: Boolean,
value: true
},
zIndex: {
type: Number,
value: 100
@ -25,6 +27,10 @@ VantComponent({
closeOnClickAction: {
type: Boolean,
value: true
},
safeAreaInsetBottom: {
type: Boolean,
value: true
}
},
methods: {

View File

@ -3,6 +3,7 @@
<van-popup
show="{{ show }}"
position="bottom"
round="{{ round }}"
z-index="{{ zIndex }}"
overlay="{{ overlay }}"
custom-class="van-action-sheet"
@ -24,6 +25,7 @@
wx:for="{{ actions }}"
wx:key="index"
open-type="{{ item.openType }}"
style="{{ item.color ? 'color: ' + item.color : '' }}"
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
hover-class="van-action-sheet__item--hover"
data-index="{{ index }}"

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-button{position:relative;display:inline-block;box-sizing:border-box;height:44px;padding:0;font-size:16px;line-height:42px;text-align:center;vertical-align:middle;border-radius:2px;border-radius:var(--button-border-radius,2px);-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);opacity:0;content:" ";background-color:#000;background-color:var(--black,#000);border-color:#000;border-color:var(--black,#000)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#333;color:var(--button-default-color,#333);background-color:#fff;background-color:var(--button-default-background-color,#fff);border:1px solid #eee;border:1px solid var(--button-default-border-color,#eee)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background-color:#07c160;background-color:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:1px solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background-color:#1989fa;background-color:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:1px solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background-color:#ee0a24;background-color:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:1px solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background-color:#ff976a;background-color:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:1px solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background-color:#fff;background-color:var(--white,#fff)}.van-button--plain.van-button--primary{color:#07c160;color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:#1989fa;color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:#ee0a24;color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:#ff976a;color:var(--button-warning-background-color,#ff976a)}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{min-width:60px;height:30px;padding:0 8px;font-size:12px;line-height:28px}.van-button--mini{display:inline-block;width:50px;height:22px;font-size:10px;line-height:20px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:block;width:100%}.van-button--round{border-radius:10em;border-radius:var(--button-round-border-radius,10em)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5}.van-button__text{display:inline}.van-button__loading-text{display:inline-block;margin-left:5px;vertical-align:middle}.van-button__icon{min-width:1em;line-height:inherit!important;vertical-align:top}.van-button__icon+.van-button__text:not(:empty){display:inline-block;margin-left:5px;vertical-align:top}.van-button--hairline{padding-top:1px;border-width:0}.van-button--hairline:after{border-color:inherit;border-width:1px;border-radius:4px;border-radius:calc(var(--button-border-radius, 2px)*2)}.van-button--hairline.van-button--round:after{border-radius:10em;border-radius:var(--button-round-border-radius,10em)}.van-button--hairline.van-button--square:after{border-radius:0}
@import '../common/index.wxss';.van-button{position:relative;display:inline-block;box-sizing:border-box;height:44px;padding:0;font-size:16px;line-height:42px;text-align:center;vertical-align:middle;transition:opacity .2s;border-radius:2px;border-radius:var(--button-border-radius,2px);-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);opacity:0;content:" ";background-color:#000;background-color:var(--black,#000);border-color:#000;border-color:var(--black,#000)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#333;color:var(--button-default-color,#333);background-color:#fff;background-color:var(--button-default-background-color,#fff);border:1px solid #eee;border:1px solid var(--button-default-border-color,#eee)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background-color:#07c160;background-color:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:1px solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background-color:#1989fa;background-color:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:1px solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background-color:#ee0a24;background-color:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:1px solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background-color:#ff976a;background-color:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:1px solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background-color:#fff;background-color:var(--white,#fff)}.van-button--plain.van-button--primary{color:#07c160;color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:#1989fa;color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:#ee0a24;color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:#ff976a;color:var(--button-warning-background-color,#ff976a)}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{min-width:60px;height:30px;padding:0 8px;font-size:12px;line-height:28px}.van-button--mini{display:inline-block;width:50px;height:22px;font-size:10px;line-height:20px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:block;width:100%}.van-button--round{border-radius:10em;border-radius:var(--button-round-border-radius,10em)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5}.van-button__text{display:inline}.van-button__loading-text{display:inline-block;margin-left:5px;vertical-align:middle}.van-button__icon{min-width:1em;line-height:inherit!important;vertical-align:top}.van-button__icon+.van-button__text:not(:empty){display:inline-block;margin-left:5px;vertical-align:top}.van-button--hairline{padding-top:1px;border-width:0}.van-button--hairline:after{border-color:inherit;border-width:1px;border-radius:4px;border-radius:calc(var(--button-border-radius, 2px)*2)}.van-button--hairline.van-button--round:after{border-radius:10em;border-radius:var(--button-round-border-radius,10em)}.van-button--hairline.van-button--square:after{border-radius:0}

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-checkbox{display:-webkit-flex;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{-webkit-flex:none;flex:none}.van-checkbox__icon{display:block;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #e5e5e5;border:1px solid var(--checkbox-border-color,#e5e5e5);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#eee;background-color:var(--checkbox-disabled-background-color,#eee);border-color:#c9c9c9;border-color:var(--checkbox-disabled-icon-color,#c9c9c9)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c9c9c9;color:var(--checkbox-disabled-icon-color,#c9c9c9)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#333;color:var(--checkbox-label-color,#333)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c9c9c9;color:var(--checkbox-disabled-label-color,#c9c9c9)}.van-checkbox__label:empty{margin:0}
@import '../common/index.wxss';.van-checkbox{display:-webkit-flex;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{-webkit-flex:none;flex:none}.van-checkbox__icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #e5e5e5;border:1px solid var(--checkbox-border-color,#e5e5e5);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#eee;background-color:var(--checkbox-disabled-background-color,#eee);border-color:#c9c9c9;border-color:var(--checkbox-disabled-icon-color,#c9c9c9)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c9c9c9;color:var(--checkbox-disabled-icon-color,#c9c9c9)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#333;color:var(--checkbox-label-color,#333)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c9c9c9;color:var(--checkbox-disabled-label-color,#c9c9c9)}.van-checkbox__label:empty{margin:0}

View File

@ -6,7 +6,7 @@ export function isObj(x) {
return x !== null && (type === 'object' || type === 'function');
}
export function isNumber(value) {
return /^\d+$/.test(value);
return /^\d+(\.\d+)?$/.test(value);
}
export function range(num, min, max) {
return Math.min(Math.max(num, min), max);

View File

@ -4,6 +4,13 @@ import { button } from '../mixins/button';
import { openType } from '../mixins/open-type';
VantComponent({
mixins: [link, button, openType],
relation: {
type: 'ancestor',
name: 'goods-action',
linked(parent) {
this.parent = parent;
}
},
props: {
text: String,
color: String,
@ -14,10 +21,31 @@ VantComponent({
value: 'danger'
}
},
mounted() {
this.updateStyle();
},
methods: {
onClick(event) {
this.$emit('click', event.detail);
this.jumpLink();
},
updateStyle() {
const { parent } = this;
const { children = [] } = parent;
const index = children.indexOf(this);
const { length } = children;
let isFirst = false;
let isLast = false;
if (index === 0) {
isFirst = true;
}
if (index === length - 1) {
isLast = true;
}
this.setData({
isFirst,
isLast
});
}
}
});

View File

@ -1,3 +1,4 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<van-button
square
id="{{ id }}"
@ -8,7 +9,7 @@
loading="{{ loading }}"
disabled="{{ disabled }}"
open-type="{{ openType }}"
custom-class="custom-class"
custom-class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast }]) }}"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}"

View File

@ -1 +1 @@
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{height:36px!important;font-weight:500!important;font-size:14px!important;line-height:34px!important;border:none!important}.van-goods-action-button--first{display:block!important;width:auto!important;margin-left:5px;border-top-left-radius:18px!important;border-bottom-left-radius:18px!important}.van-goods-action-button--last{display:block!important;width:auto!important;margin-right:5px;border-top-right-radius:18px!important;border-bottom-right-radius:18px!important}.van-goods-action-button--warning{background:linear-gradient(90deg,#ffd01e,#ff8917)}.van-goods-action-button--danger{background:linear-gradient(90deg,#ff6034,#ee0a24)}@media (max-width:321px){.van-goods-action-button{font-size:13px}}

View File

@ -7,6 +7,7 @@ VantComponent({
mixins: [link, button, openType],
props: {
text: String,
dot: Boolean,
info: String,
icon: String,
disabled: Boolean,

View File

@ -22,11 +22,12 @@
bindgetphonenumber="bindGetPhoneNumber"
bindlaunchapp="bindLaunchApp"
>
<view class="van-goods-action-icon__content van-hairline--right">
<view class="van-goods-action-icon__content">
<van-icon
wx:if="{{ icon }}"
size="20px"
name="{{ icon }}"
dot="{{ dot }}"
info="{{ info }}"
class="van-goods-action-icon__icon"
custom-class="icon-class"

View File

@ -1,5 +1,22 @@
import { VantComponent } from '../common/component';
import { safeArea } from '../mixins/safe-area';
VantComponent({
mixins: [safeArea()]
relation: {
type: 'descendant',
name: 'goods-action-button',
linked(child) {
this.children.push(child);
},
unlinked(child) {
this.children = this.children.filter((item) => item !== child);
}
},
beforeCreate() {
this.children = [];
},
props: {
safeAreaInsetBottom: {
type: Boolean,
value: true
}
}
});

View File

@ -1,5 +1,5 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="custom-class {{ utils.bem('goods-action', { safe: isIPhoneX && safeAreaInsetBottom }) }}">
<view class="custom-class {{ utils.bem('goods-action', { safe: safeAreaInsetBottom }) }}">
<slot />
</view>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;background-color:#fff;background-color:var(--white,#fff)}.van-goods-action--safe{padding-bottom:34px;padding-bottom:var(--safe-area-inset-bottom,34px)}
@import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;background-color:#fff;background-color:var(--white,#fff)}.van-goods-action--safe{padding-bottom:env(safe-area-inset-bottom)}

View File

@ -11,6 +11,8 @@ VantComponent({
mixins: [link],
props: {
icon: String,
dot: Boolean,
info: null,
text: String,
useSlot: Boolean
},

View File

@ -7,7 +7,7 @@
</block>
<block wx:else>
<view class="van-grid-item__icon">
<van-icon wx:if="{{ icon }}" name="{{ icon }}" />
<van-icon wx:if="{{ icon }}" name="{{ icon }}" dot="{{ dot }}" info="{{ info }}" />
<slot wx:else name="icon"></slot>
</view>
<view class="van-grid-item__text">

View File

@ -1,4 +0,0 @@
export declare const safeArea: ({ safeAreaInsetBottom, safeAreaInsetTop }?: {
safeAreaInsetBottom?: boolean;
safeAreaInsetTop?: boolean;
}) => string;

View File

@ -1,39 +0,0 @@
let cache = null;
function getSafeArea() {
return new Promise((resolve, reject) => {
if (cache != null) {
resolve(cache);
}
else {
wx.getSystemInfo({
success: ({ model, screenHeight, statusBarHeight }) => {
const iphoneX = /iphone x/i.test(model);
const iphoneNew = /iPhone11/i.test(model) && screenHeight === 812;
cache = {
isIPhoneX: iphoneX || iphoneNew,
statusBarHeight
};
resolve(cache);
},
fail: reject
});
}
});
}
export const safeArea = ({ safeAreaInsetBottom = true, safeAreaInsetTop = false } = {}) => Behavior({
properties: {
safeAreaInsetTop: {
type: Boolean,
value: safeAreaInsetTop
},
safeAreaInsetBottom: {
type: Boolean,
value: safeAreaInsetBottom
}
},
created() {
getSafeArea().then(({ isIPhoneX, statusBarHeight }) => {
this.setData({ isIPhoneX, statusBarHeight });
});
}
});

View File

@ -1,7 +1,5 @@
import { VantComponent } from '../common/component';
import { safeArea } from '../mixins/safe-area';
VantComponent({
mixins: [safeArea({ safeAreaInsetTop: true })],
classes: ['title-class'],
props: {
title: String,
@ -16,7 +14,11 @@ VantComponent({
zIndex: {
type: Number,
value: 1
}
},
safeAreaInsetTop: {
type: Boolean,
value: true
},
},
methods: {
onClickLeft() {

View File

@ -1,8 +1,8 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view
class="{{ utils.bem('nav-bar', { fixed }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}"
style="z-index: {{ zIndex }}; {{ safeAreaInsetTop ? 'padding-top: ' + statusBarHeight + 'px;' : '' }}"
class="{{ utils.bem('nav-bar', { fixed, safe: safeAreaInsetTop }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}"
style="z-index: {{ zIndex }};"
>
<view class="van-nav-bar__left" bind:tap="onClickLeft">
<block wx:if="{{ leftArrow || leftText }}">

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--white,#fff)}.van-nav-bar__text{display:inline-block;margin:0 -15px;padding:0 15px;vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-weight:500;font-size:16px}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}
@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--white,#fff)}.van-nav-bar--safe{padding-top:env(safe-area-inset-top)}.van-nav-bar__text{display:inline-block;margin:0 -15px;padding:0 15px;vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-weight:500;font-size:16px}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}

View File

@ -1,8 +1,6 @@
import { VantComponent } from '../common/component';
import { WHITE } from '../common/color';
import { safeArea } from '../mixins/safe-area';
VantComponent({
mixins: [safeArea()],
props: {
message: String,
background: String,
@ -21,6 +19,10 @@ VantComponent({
zIndex: {
type: Number,
value: 110
},
safeAreaInsetTop: {
type: Boolean,
value: false
}
},
methods: {

View File

@ -1,10 +1,15 @@
<van-transition
name="slide-down"
show="{{ show }}"
custom-class="van-notify van-notify--{{ type }}"
custom-style="background:{{ background }}; color: {{ color }}; z-index: {{ zIndex }};"
custom-class="van-notify__container"
custom-style="z-index: {{ zIndex }};"
bind:tap="onTap"
>
<view wx:if="{{ safeAreaInsetTop }}" style="padding-top: {{ statusBarHeight }}px"></view>
<text>{{ message }}</text>
<view
class="van-notify van-notify--{{ type }}"
style="background:{{ background }};color:{{ color }};"
>
<view wx:if="{{ safeAreaInsetTop }}" class="van-notify__safe-area"></view>
<text>{{ message }}</text>
</view>
</van-transition>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-notify{position:fixed;top:0;box-sizing:border-box;width:100%;text-align:center;word-wrap:break-word;padding:6px 15px;padding:var(--notify-padding,6px 15px);font-size:14px;font-size:var(--notify-font-size,14px);line-height:20px;line-height:var(--notify-line-height,20px)}.van-notify--primary{background-color:#1989fa;background-color:var(--notify-primary-background-color,#1989fa)}.van-notify--success{background-color:#07c160;background-color:var(--notify-success-background-color,#07c160)}.van-notify--danger{background-color:#ee0a24;background-color:var(--notify-danger-background-color,#ee0a24)}.van-notify--warning{background-color:#ff976a;background-color:var(--notify-warning-background-color,#ff976a)}
@import '../common/index.wxss';.van-notify{text-align:center;word-wrap:break-word;padding:6px 15px;padding:var(--notify-padding,6px 15px);font-size:14px;font-size:var(--notify-font-size,14px);line-height:20px;line-height:var(--notify-line-height,20px)}.van-notify__container{position:fixed;top:0;box-sizing:border-box;width:100%}.van-notify__safe-area{height:constant(safe-area-inset-top);height:env(safe-area-inset-top)}.van-notify--primary{background-color:#1989fa;background-color:var(--notify-primary-background-color,#1989fa)}.van-notify--success{background-color:#07c160;background-color:var(--notify-success-background-color,#07c160)}.van-notify--danger{background-color:#ee0a24;background-color:var(--notify-danger-background-color,#ee0a24)}.van-notify--warning{background-color:#ff976a;background-color:var(--notify-warning-background-color,#ff976a)}

11
dist/popup/index.js vendored
View File

@ -1,6 +1,5 @@
import { VantComponent } from '../common/component';
import { transition } from '../mixins/transition';
import { safeArea } from '../mixins/safe-area';
VantComponent({
classes: [
'enter-class',
@ -10,7 +9,7 @@ VantComponent({
'leave-active-class',
'leave-to-class'
],
mixins: [transition(false), safeArea()],
mixins: [transition(false)],
props: {
round: Boolean,
closeable: Boolean,
@ -44,6 +43,14 @@ VantComponent({
type: String,
value: 'center',
observer: 'observeClass'
},
safeAreaInsetBottom: {
type: Boolean,
value: true
},
safeAreaInsetTop: {
type: Boolean,
value: false
}
},
created() {

View File

@ -10,8 +10,8 @@
/>
<view
wx:if="{{ inited }}"
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: isIPhoneX && safeAreaInsetBottom }]) }}"
style="z-index: {{ zIndex }}; -webkit-transition-duration:{{ currentDuration }}ms; transition-duration:{{ currentDuration }}ms; {{ display ? '' : 'display: none;' }} {{ safeAreaInsetTop ? 'padding-top: ' + statusBarHeight + 'px;' : '' }} {{ customStyle }}"
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop }]) }}"
style="z-index: {{ zIndex }}; -webkit-transition-duration:{{ currentDuration }}ms; transition-duration:{{ currentDuration }}ms; {{ display ? '' : 'display: none;' }};{{ customStyle }}"
bind:transitionend="onTransitionEnd"
>
<slot />

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-popup{position:fixed;top:50%;left:50%;box-sizing:border-box;max-height:100%;overflow-y:auto;transition-timing-function:ease;-webkit-animation:ease both;animation:ease both;-webkit-overflow-scrolling:touch;background-color:#fff;background-color:var(--white,#fff)}.van-popup--center{-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup--center.van-popup--round{border-radius:12px;border-radius:var(--popup-round-border-radius,12px)}.van-popup--top{top:0;right:auto;bottom:auto;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--top.van-popup--round{border-radius:0 0 12px 12px;border-radius:0 0 var(--popup-round-border-radius,12px) var(--popup-round-border-radius,12px)}.van-popup--right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--right.van-popup--round{border-radius:12px 0 0 12px;border-radius:var(--popup-round-border-radius,12px) 0 0 var(--popup-round-border-radius,12px)}.van-popup--bottom{top:auto;right:auto;bottom:0;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--bottom.van-popup--round{border-radius:12px 12px 0 0;border-radius:var(--popup-round-border-radius,12px) var(--popup-round-border-radius,12px) 0 0}.van-popup--left{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--left.van-popup--round{border-radius:0 12px 12px 0;border-radius:0 var(--popup-round-border-radius,12px) var(--popup-round-border-radius,12px) 0}.van-popup--bottom.van-popup--safe{padding-bottom:34px;padding-bottom:var(--safe-area-inset-bottom,34px)}.van-popup__close-icon{position:absolute;z-index:1;z-index:var(--popup-close-icon-z-index,1);color:#999;color:var(--popup-close-icon-color,#999);font-size:18px;font-size:var(--popup-close-icon-size,18px)}.van-popup__close-icon--top-left{top:16px;top:var(--popup-close-icon-margin,16px);left:16px;left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--top-right{top:16px;top:var(--popup-close-icon-margin,16px);right:16px;right:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-left{bottom:16px;bottom:var(--popup-close-icon-margin,16px);left:16px;left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-right{right:16px;right:var(--popup-close-icon-margin,16px);bottom:16px;bottom:var(--popup-close-icon-margin,16px)}.van-popup__close-icon:active{opacity:.6}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.van-scale-enter,.van-scale-leave-to{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-bottom-enter,.van-bottom-leave-to{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}.van-top-enter,.van-top-leave-to{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}.van-left-enter,.van-left-leave-to{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}
@import '../common/index.wxss';.van-popup{position:fixed;top:50%;left:50%;box-sizing:border-box;max-height:100%;overflow-y:auto;transition-timing-function:ease;-webkit-animation:ease both;animation:ease both;-webkit-overflow-scrolling:touch;background-color:#fff;background-color:var(--white,#fff)}.van-popup--center{-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup--center.van-popup--round{border-radius:20px;border-radius:var(--popup-round-border-radius,20px)}.van-popup--top{top:0;right:auto;bottom:auto;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--top.van-popup--round{border-radius:0 0 20px 20px;border-radius:0 0 var(--popup-round-border-radius,20px) var(--popup-round-border-radius,20px)}.van-popup--right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--right.van-popup--round{border-radius:20px 0 0 20px;border-radius:var(--popup-round-border-radius,20px) 0 0 var(--popup-round-border-radius,20px)}.van-popup--bottom{top:auto;right:auto;bottom:0;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--bottom.van-popup--round{border-radius:20px 20px 0 0;border-radius:var(--popup-round-border-radius,20px) var(--popup-round-border-radius,20px) 0 0}.van-popup--left{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--left.van-popup--round{border-radius:0 20px 20px 0;border-radius:0 var(--popup-round-border-radius,20px) var(--popup-round-border-radius,20px) 0}.van-popup--bottom.van-popup--safe{padding-bottom:env(safe-area-inset-bottom)}.van-popup--safeTop{padding-top:env(safe-area-inset-top)}.van-popup__close-icon{position:absolute;z-index:1;z-index:var(--popup-close-icon-z-index,1);color:#999;color:var(--popup-close-icon-color,#999);font-size:18px;font-size:var(--popup-close-icon-size,18px)}.van-popup__close-icon--top-left{top:16px;top:var(--popup-close-icon-margin,16px);left:16px;left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--top-right{top:16px;top:var(--popup-close-icon-margin,16px);right:16px;right:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-left{bottom:16px;bottom:var(--popup-close-icon-margin,16px);left:16px;left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-right{right:16px;right:var(--popup-close-icon-margin,16px);bottom:16px;bottom:var(--popup-close-icon-margin,16px)}.van-popup__close-icon:active{opacity:.6}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.van-scale-enter,.van-scale-leave-to{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-bottom-enter,.van-bottom-leave-to{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}.van-top-enter,.van-top-leave-to{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}.van-left-enter,.van-left-leave-to{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}

7
dist/rate/index.js vendored
View File

@ -81,14 +81,11 @@ VantComponent({
const { touchable } = this.data;
if (!touchable)
return;
const { clientX, clientY } = event.touches[0];
const { clientX } = event.touches[0];
this.getRect('.van-rate__icon', true).then((list) => {
const target = list
.sort(item => item.right - item.left)
.find(item => clientX >= item.left &&
clientX <= item.right &&
clientY >= item.top &&
clientY <= item.bottom);
.find(item => clientX >= item.left && clientX <= item.right);
if (target != null) {
this.onSelect(Object.assign(Object.assign({}, event), { currentTarget: target }));
}

17
dist/stepper/index.js vendored
View File

@ -1,5 +1,5 @@
import { VantComponent } from '../common/component';
import { addUnit } from '../common/utils';
import { addUnit, isDef } from '../common/utils';
const LONG_PRESS_START_TIME = 600;
const LONG_PRESS_INTERVAL = 200;
VantComponent({
@ -13,6 +13,7 @@ VantComponent({
buttonSize: null,
asyncChange: Boolean,
disableInput: Boolean,
decimalLength: Number,
min: {
type: null,
value: 1
@ -84,7 +85,14 @@ VantComponent({
// limit value range
range(value) {
value = String(value).replace(/[^0-9.-]/g, '');
return Math.max(Math.min(this.data.max, value), this.data.min);
// format range
value = value === '' ? 0 : +value;
value = Math.max(Math.min(this.data.max, value), this.data.min);
// format decimal
if (isDef(this.data.decimalLength)) {
value = value.toFixed(this.data.decimalLength);
}
return value;
},
onInput(event) {
const { value = '' } = event.detail || {};
@ -97,7 +105,10 @@ VantComponent({
return;
}
const diff = type === 'minus' ? -this.data.step : +this.data.step;
const value = Math.round((+this.data.value + diff) * 100) / 100;
let value = +this.data.value + diff;
if (!isDef(this.data.decimalLength)) {
value = Math.round(value * 100) / 100;
}
this.triggerInput(this.range(value));
this.$emit(type);
},

View File

@ -1,7 +1,5 @@
import { VantComponent } from '../common/component';
import { safeArea } from '../mixins/safe-area';
VantComponent({
mixins: [safeArea()],
classes: [
'bar-class',
'price-class',
@ -35,7 +33,11 @@ VantComponent({
value: 2,
observer: 'updatePrice'
},
suffixLabel: String
suffixLabel: String,
safeAreaInsetBottom: {
type: Boolean,
value: true
}
},
methods: {
updatePrice() {

View File

@ -16,7 +16,7 @@
<slot name="tip" />
</view>
<view class="bar-class {{ utils.bem('submit-bar__bar', { safe: safeAreaInsetBottom && isIPhoneX }) }}">
<view class="bar-class {{ utils.bem('submit-bar__bar', { safe: safeAreaInsetBottom }) }}">
<slot />
<view wx:if="{{ hasPrice }}" class="van-submit-bar__text">
<text>{{ label || '合计:' }}</text>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-submit-bar{position:fixed;bottom:0;left:0;width:100%;-webkit-user-select:none;user-select:none;z-index:100;z-index:var(--submit-bar-z-index,100)}.van-submit-bar__tip{padding:10px;padding:var(--submit-bar-tip-padding,10px);color:#f56723;color:var(--submit-bar-tip-color,#f56723);font-size:12px;font-size:var(--submit-bar-tip-font-size,12px);line-height:1.5;line-height:var(--submit-bar-tip-line-height,1.5);background-color:#fff7cc;background-color:var(--submit-bar-tip-background-color,#fff7cc)}.van-submit-bar__tip:empty{display:none}.van-submit-bar__tip-icon{width:12px;height:12px;margin-right:4px;vertical-align:middle}.van-submit-bar__tip-text{display:inline;vertical-align:middle}.van-submit-bar__bar{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:flex-end;justify-content:flex-end;height:50px;height:var(--submit-bar-height,50px);font-size:14px;font-size:var(--submit-bar-text-font-size,14px);background-color:#fff;background-color:var(--submit-bar-background-color,#fff)}.van-submit-bar__bar--safe{padding-bottom:34px;padding-bottom:var(--safe-area-inset-bottom,34px)}.van-submit-bar__text{-webkit-flex:1;flex:1;padding-right:12px;font-weight:500;text-align:right;color:#333;color:var(--submit-bar-text-color,#333)}.van-submit-bar__price{color:#ee0a24;color:var(--submit-bar-price-color,#ee0a24);font-size:18px;font-size:var(--submit-bar-price-font-size,18px)}.van-submit-bar__currency{font-size:14px;font-size:var(--submit-bar-currency-font-size,14px)}.van-submit-bar__suffix-label{margin-left:5px}.van-submit-bar__button{width:110px;width:var(--submit-bar-button-width,110px)}
@import '../common/index.wxss';.van-submit-bar{position:fixed;bottom:0;left:0;width:100%;-webkit-user-select:none;user-select:none;z-index:100;z-index:var(--submit-bar-z-index,100)}.van-submit-bar__tip{padding:10px;padding:var(--submit-bar-tip-padding,10px);color:#f56723;color:var(--submit-bar-tip-color,#f56723);font-size:12px;font-size:var(--submit-bar-tip-font-size,12px);line-height:1.5;line-height:var(--submit-bar-tip-line-height,1.5);background-color:#fff7cc;background-color:var(--submit-bar-tip-background-color,#fff7cc)}.van-submit-bar__tip:empty{display:none}.van-submit-bar__tip-icon{width:12px;height:12px;margin-right:4px;vertical-align:middle}.van-submit-bar__tip-text{display:inline;vertical-align:middle}.van-submit-bar__bar{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:flex-end;justify-content:flex-end;height:50px;height:var(--submit-bar-height,50px);font-size:14px;font-size:var(--submit-bar-text-font-size,14px);background-color:#fff;background-color:var(--submit-bar-background-color,#fff)}.van-submit-bar__bar--safe{padding-bottom:env(safe-area-inset-bottom)}.van-submit-bar__text{-webkit-flex:1;flex:1;padding-right:12px;font-weight:500;text-align:right;color:#333;color:var(--submit-bar-text-color,#333)}.van-submit-bar__price{color:#ee0a24;color:var(--submit-bar-price-color,#ee0a24);font-size:18px;font-size:var(--submit-bar-price-font-size,18px)}.van-submit-bar__currency{font-size:14px;font-size:var(--submit-bar-currency-font-size,14px)}.van-submit-bar__suffix-label{margin-left:5px}.van-submit-bar__button{width:110px;width:var(--submit-bar-button-width,110px)}

View File

@ -1,6 +1,7 @@
import { VantComponent } from '../common/component';
import { touch } from '../mixins/touch';
const THRESHOLD = 0.3;
let ARRAY = [];
VantComponent({
props: {
disabled: Boolean,
@ -24,6 +25,10 @@ VantComponent({
},
created() {
this.offset = 0;
ARRAY.push(this);
},
destroyed() {
ARRAY = ARRAY.filter(item => item !== this);
},
methods: {
open(position) {
@ -67,6 +72,11 @@ VantComponent({
if (this.data.disabled) {
return;
}
ARRAY.forEach(item => {
if (item !== this) {
item.close();
}
});
this.draging = true;
this.startOffset = this.offset;
this.firstDirection = '';

10
dist/tab/index.js vendored
View File

@ -9,7 +9,12 @@ VantComponent({
info: null,
title: String,
disabled: Boolean,
titleStyle: String
titleStyle: String,
name: {
type: [Number, String],
value: '',
observer: 'setComputedName'
}
},
data: {
width: null,
@ -25,6 +30,9 @@ VantComponent({
titleStyle: 'update'
},
methods: {
setComputedName() {
this.computedName = this.data.name || this.index;
},
update() {
const parent = this.getRelationNodes('../tabs/index')[0];
if (parent) {

View File

@ -1,7 +1,5 @@
import { VantComponent } from '../common/component';
import { safeArea } from '../mixins/safe-area';
VantComponent({
mixins: [safeArea()],
relation: {
name: 'tabbar-item',
type: 'descendant',
@ -39,6 +37,10 @@ VantComponent({
zIndex: {
type: Number,
value: 1
},
safeAreaInsetBottom: {
type: Boolean,
value: true
}
},
beforeCreate() {

View File

@ -1,7 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view
class="custom-class {{ border ? 'van-hairline--top-bottom' : '' }} {{ utils.bem('tabbar', { fixed, safe: isIPhoneX && safeAreaInsetBottom }) }}"
class="custom-class {{ border ? 'van-hairline--top-bottom' : '' }} {{ utils.bem('tabbar', { fixed, safe: safeAreaInsetBottom }) }}"
style="{{ zIndex ? 'z-index: ' + zIndex : '' }}"
>
<slot />

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-tabbar{display:-webkit-flex;display:flex;width:100%;height:50px;background-color:#fff;background-color:var(--white,#fff)}.van-tabbar--fixed{position:fixed;bottom:0;left:0}.van-tabbar--safe{padding-bottom:34px;padding-bottom:var(--safe-area-inset-bottom,34px)}
@import '../common/index.wxss';.van-tabbar{display:-webkit-flex;display:flex;width:100%;height:50px;background-color:#fff;background-color:var(--white,#fff)}.van-tabbar--fixed{position:fixed;bottom:0;left:0}.van-tabbar--safe{padding-bottom:env(safe-area-inset-bottom)}

98
dist/tabs/index.js vendored
View File

@ -1,6 +1,6 @@
import { VantComponent } from '../common/component';
import { touch } from '../mixins/touch';
import { nextTick } from '../common/utils';
import { nextTick, isDef, addUnit } from '../common/utils';
VantComponent({
mixins: [touch],
classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class'],
@ -8,14 +8,23 @@ VantComponent({
name: 'tab',
type: 'descendant',
linked(child) {
this.child.push(child);
child.index = this.children.length;
child.setComputedName();
this.children.push(child);
this.updateTabs(this.data.tabs.concat(child.data));
},
unlinked(child) {
const index = this.child.indexOf(child);
const index = this.children.indexOf(child);
const { tabs } = this.data;
tabs.splice(index, 1);
this.child.splice(index, 1);
this.children.splice(index, 1);
let i = index;
while (i >= 0 && i < this.children.length) {
const currentChild = this.children[i];
currentChild.index--;
currentChild.setComputedName();
i++;
}
this.updateTabs(tabs);
}
},
@ -25,16 +34,16 @@ VantComponent({
animated: Boolean,
swipeable: Boolean,
lineWidth: {
type: Number,
type: [String, Number],
value: -1
},
lineHeight: {
type: Number,
type: [String, Number],
value: -1
},
active: {
type: Number,
value: 0
type: [String, Number],
value: 0,
},
type: {
type: String,
@ -68,12 +77,13 @@ VantComponent({
scrollable: false,
trackStyle: '',
wrapStyle: '',
position: ''
position: '',
currentIndex: null,
},
watch: {
swipeThreshold() {
this.setData({
scrollable: this.child.length > this.data.swipeThreshold
scrollable: this.children.length > this.data.swipeThreshold
});
},
color: 'setLine',
@ -84,7 +94,7 @@ VantComponent({
offsetTop: 'setWrapStyle'
},
beforeCreate() {
this.child = [];
this.children = [];
},
mounted() {
this.setLine(true);
@ -108,26 +118,28 @@ VantComponent({
});
this.setActiveTab();
},
trigger(eventName, index) {
trigger(eventName, name) {
const { tabs, currentIndex } = this.data;
this.$emit(eventName, {
index,
title: this.data.tabs[index].title
name,
title: tabs[currentIndex].title
});
},
onTap(event) {
const { index } = event.currentTarget.dataset;
const child = this.children[index];
if (this.data.tabs[index].disabled) {
this.trigger('disabled', index);
this.trigger('disabled', child.computedName);
}
else {
this.trigger('click', index);
this.setActive(index);
this.trigger('click', child.computedName);
this.setActive(child.computedName);
}
},
setActive(active) {
if (active !== this.data.active) {
this.trigger('change', active);
this.setData({ active });
setActive(computedName) {
if (computedName !== this.currentName) {
this.currentName = computedName;
this.trigger('change', computedName);
this.setActiveTab();
}
},
@ -135,13 +147,13 @@ VantComponent({
if (this.data.type !== 'line') {
return;
}
const { color, active, duration, lineWidth, lineHeight } = this.data;
const { color, duration, currentIndex, lineWidth, lineHeight } = this.data;
this.getRect('.van-tab', true).then((rects) => {
const rect = rects[active];
const rect = rects[currentIndex];
const width = lineWidth !== -1 ? lineWidth : rect.width / 2;
const height = lineHeight !== -1 ? `height: ${lineHeight}px;` : '';
const height = lineHeight !== -1 ? `height: ${addUnit(lineHeight)}; border-radius: ${addUnit(lineHeight)};` : '';
let left = rects
.slice(0, active)
.slice(0, currentIndex)
.reduce((prev, curr) => prev + curr.width, 0);
left += (rect.width - width) / 2;
const transition = skipTransition
@ -150,7 +162,7 @@ VantComponent({
this.setData({
lineStyle: `
${height}
width: ${width}px;
width: ${addUnit(width)};
background-color: ${color};
-webkit-transform: translateX(${left}px);
transform: translateX(${left}px);
@ -160,32 +172,38 @@ VantComponent({
});
},
setTrack() {
const { animated, active, duration } = this.data;
const { animated, duration, currentIndex } = this.data;
if (!animated)
return '';
this.getRect('.van-tabs__content').then((rect) => {
const { width } = rect;
this.setData({
trackStyle: `
width: ${width * this.child.length}px;
left: ${-1 * active * width}px;
width: ${width * this.children.length}px;
left: ${-1 * currentIndex * width}px;
transition: left ${duration}s;
display: -webkit-box;
display: flex;
`
});
const data = { width, animated };
this.child.forEach((item) => {
this.children.forEach((item) => {
item.setData(data);
});
});
},
setActiveTab() {
this.child.forEach((item, index) => {
if (!isDef(this.currentName)) {
this.currentName = this.data.active || this.children[0].computedName;
}
this.children.forEach((item, index) => {
const data = {
active: index === this.data.active
active: item.computedName === this.currentName
};
if (data.active) {
this.setData({
currentIndex: index
});
data.inited = true;
}
if (data.active !== item.data.active) {
@ -200,7 +218,7 @@ VantComponent({
},
// scroll active tab into view
scrollIntoView() {
const { active, scrollable } = this.data;
const { currentIndex, scrollable } = this.data;
if (!scrollable) {
return;
}
@ -208,9 +226,9 @@ VantComponent({
this.getRect('.van-tab', true),
this.getRect('.van-tabs__nav')
]).then(([tabRects, navRect]) => {
const tabRect = tabRects[active];
const tabRect = tabRects[currentIndex];
const offsetLeft = tabRects
.slice(0, active)
.slice(0, currentIndex)
.reduce((prev, curr) => prev + curr.width, 0);
this.setData({
scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2
@ -231,15 +249,15 @@ VantComponent({
onTouchEnd() {
if (!this.data.swipeable)
return;
const { active, tabs } = this.data;
const { tabs, currentIndex } = this.data;
const { direction, deltaX, offsetX } = this;
const minSwipeDistance = 50;
if (direction === 'horizontal' && offsetX >= minSwipeDistance) {
if (deltaX > 0 && active !== 0) {
this.setActive(active - 1);
if (deltaX > 0 && currentIndex !== 0) {
this.setActive(this.children[currentIndex - 1].computedName);
}
else if (deltaX < 0 && active !== tabs.length - 1) {
this.setActive(active + 1);
else if (deltaX < 0 && currentIndex !== tabs.length - 1) {
this.setActive(this.children[currentIndex + 1].computedName);
}
}
},

View File

@ -17,15 +17,16 @@
wx:for="{{ tabs }}"
wx:key="index"
data-index="{{ index }}"
class="van-ellipsis tab-class {{ index === active ? 'tab-active-class' : '' }} {{ utils.bem('tab', { active: index === active, disabled: item.disabled }) }}"
style="{{ color && index !== active && type === 'card' && !item.disabled ? 'color: ' + color : '' }} {{ color && index === active && type === 'card' ? ';background-color:' + color : '' }} {{ color ? ';border-color: ' + color : '' }} {{ scrollable ? ';flex-basis:' + (88 / swipeThreshold) + '%' : '' }}"
class="van-ellipsis tab-class {{ index === currentIndex ? 'tab-active-class' : '' }} {{ utils.bem('tab', { active: index === currentIndex, disabled: item.disabled }) }}"
style="{{ color && index !== currentIndex && type === 'card' && !item.disabled ? 'color: ' + color : '' }} {{ color && index === currentIndex && type === 'card' ? ';background-color:' + color : '' }} {{ color ? ';border-color: ' + color : '' }} {{ scrollable ? ';flex-basis:' + (88 / swipeThreshold) + '%' : '' }}"
bind:tap="onTap"
>
<view class="van-ellipsis {{ utils.bem('tab__title', { dot: item.dot }) }}" style="{{ item.titleStyle }}">
<view class="van-ellipsis" style="{{ item.titleStyle }}">
{{ item.title }}
<van-info
wx:if="{{ item.info !== null }}"
wx:if="{{ item.info !== null || item.dot }}"
info="{{ item.info }}"
dot="{{ item.dot }}"
custom-class="van-tab__title__info"
/>
</view>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{position:absolute;top:0;right:0;left:0;display:-webkit-flex;display:flex;background-color:#fff;background-color:var(--white,#fff)}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__scroll--card{border-radius:2px;border:1px solid #ee0a24;border:1px solid var(--red,#ee0a24)}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--line{height:100%}.van-tabs__nav--card{height:30px;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{color:#ee0a24;color:var(--red,#ee0a24);line-height:30px;line-height:var(--tabs-card-height,30px);border-right:1px solid #ee0a24;border-right:1px solid var(--red,#ee0a24)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;color:var(--white,#fff);background-color:#ee0a24;background-color:var(--red,#ee0a24)}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;border-radius:3px;background-color:#ee0a24;background-color:var(--red,#ee0a24)}.van-tabs--line{padding-top:44px;padding-top:var(--tabs-line-height,44px)}.van-tabs--line .van-tabs__wrap{height:44px;height:var(--tabs-line-height,44px)}.van-tabs--card{margin:0 15px;padding-top:30px;padding-top:var(--tabs-card-height,30px)}.van-tabs--card .van-tabs__wrap{height:30px;height:var(--tabs-card-height,30px)}.van-tabs__content{overflow:hidden}.van-tab,.van-tabs__track{position:relative}.van-tab{-webkit-flex:1;flex:1;box-sizing:border-box;min-width:0;padding:0 5px;font-size:14px;text-align:center;cursor:pointer;color:#7d7e80;color:var(--gray-darker,#7d7e80);line-height:44px;line-height:var(--tabs-line-height,44px)}.van-tab--active{font-weight:500;color:#333;color:var(--text-color,#333)}.van-tab--disabled{color:#c9c9c9;color:var(--gray,#c9c9c9)}.van-tab__title--dot:after{display:inline-block;width:8px;height:8px;vertical-align:middle;border-radius:100%;content:"";background-color:#ee0a24;background-color:var(--red,#ee0a24)}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{position:absolute;top:0;right:0;left:0;display:-webkit-flex;display:flex;background-color:#fff;background-color:var(--white,#fff)}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__scroll--card{border-radius:2px;border:1px solid #ee0a24;border:1px solid var(--red,#ee0a24)}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--line{height:100%}.van-tabs__nav--card{height:30px;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{color:#ee0a24;color:var(--red,#ee0a24);line-height:30px;line-height:var(--tabs-card-height,30px);border-right:1px solid #ee0a24;border-right:1px solid var(--red,#ee0a24)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;color:var(--white,#fff);background-color:#ee0a24;background-color:var(--red,#ee0a24)}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;border-radius:3px;background-color:#ee0a24;background-color:var(--red,#ee0a24)}.van-tabs--line{padding-top:44px;padding-top:var(--tabs-line-height,44px)}.van-tabs--line .van-tabs__wrap{height:44px;height:var(--tabs-line-height,44px)}.van-tabs--card{margin:0 15px;padding-top:30px;padding-top:var(--tabs-card-height,30px)}.van-tabs--card .van-tabs__wrap{height:30px;height:var(--tabs-card-height,30px)}.van-tabs__content{overflow:hidden}.van-tab,.van-tabs__track{position:relative}.van-tab{-webkit-flex:1;flex:1;box-sizing:border-box;min-width:0;padding:0 5px;font-size:14px;text-align:center;cursor:pointer;color:#7d7e80;color:var(--gray-darker,#7d7e80);line-height:44px;line-height:var(--tabs-line-height,44px)}.van-tab--active{font-weight:500;color:#333;color:var(--text-color,#333)}.van-tab--disabled{color:#c9c9c9;color:var(--gray,#c9c9c9)}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}

View File

@ -1,13 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var safe_area_1 = require("../mixins/safe-area");
component_1.VantComponent({
mixins: [safe_area_1.safeArea()],
props: {
show: Boolean,
title: String,
cancelText: String,
round: {
type: Boolean,
value: true
},
zIndex: {
type: Number,
value: 100
@ -27,6 +29,10 @@ component_1.VantComponent({
closeOnClickAction: {
type: Boolean,
value: true
},
safeAreaInsetBottom: {
type: Boolean,
value: true
}
},
methods: {

View File

@ -3,6 +3,7 @@
<van-popup
show="{{ show }}"
position="bottom"
round="{{ round }}"
z-index="{{ zIndex }}"
overlay="{{ overlay }}"
custom-class="van-action-sheet"
@ -24,6 +25,7 @@
wx:for="{{ actions }}"
wx:key="index"
open-type="{{ item.openType }}"
style="{{ item.color ? 'color: ' + item.color : '' }}"
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
hover-class="van-action-sheet__item--hover"
data-index="{{ index }}"

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-button{position:relative;display:inline-block;box-sizing:border-box;height:44px;padding:0;font-size:16px;line-height:42px;text-align:center;vertical-align:middle;border-radius:2px;border-radius:var(--button-border-radius,2px);-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);opacity:0;content:" ";background-color:#000;background-color:var(--black,#000);border-color:#000;border-color:var(--black,#000)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#333;color:var(--button-default-color,#333);background-color:#fff;background-color:var(--button-default-background-color,#fff);border:1px solid #eee;border:1px solid var(--button-default-border-color,#eee)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background-color:#07c160;background-color:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:1px solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background-color:#1989fa;background-color:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:1px solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background-color:#ee0a24;background-color:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:1px solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background-color:#ff976a;background-color:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:1px solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background-color:#fff;background-color:var(--white,#fff)}.van-button--plain.van-button--primary{color:#07c160;color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:#1989fa;color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:#ee0a24;color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:#ff976a;color:var(--button-warning-background-color,#ff976a)}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{min-width:60px;height:30px;padding:0 8px;font-size:12px;line-height:28px}.van-button--mini{display:inline-block;width:50px;height:22px;font-size:10px;line-height:20px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:block;width:100%}.van-button--round{border-radius:10em;border-radius:var(--button-round-border-radius,10em)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5}.van-button__text{display:inline}.van-button__loading-text{display:inline-block;margin-left:5px;vertical-align:middle}.van-button__icon{min-width:1em;line-height:inherit!important;vertical-align:top}.van-button__icon+.van-button__text:not(:empty){display:inline-block;margin-left:5px;vertical-align:top}.van-button--hairline{padding-top:1px;border-width:0}.van-button--hairline:after{border-color:inherit;border-width:1px;border-radius:4px;border-radius:calc(var(--button-border-radius, 2px)*2)}.van-button--hairline.van-button--round:after{border-radius:10em;border-radius:var(--button-round-border-radius,10em)}.van-button--hairline.van-button--square:after{border-radius:0}
@import '../common/index.wxss';.van-button{position:relative;display:inline-block;box-sizing:border-box;height:44px;padding:0;font-size:16px;line-height:42px;text-align:center;vertical-align:middle;transition:opacity .2s;border-radius:2px;border-radius:var(--button-border-radius,2px);-webkit-appearance:none;-webkit-text-size-adjust:100%}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);opacity:0;content:" ";background-color:#000;background-color:var(--black,#000);border-color:#000;border-color:var(--black,#000)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#333;color:var(--button-default-color,#333);background-color:#fff;background-color:var(--button-default-background-color,#fff);border:1px solid #eee;border:1px solid var(--button-default-border-color,#eee)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background-color:#07c160;background-color:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:1px solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background-color:#1989fa;background-color:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:1px solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background-color:#ee0a24;background-color:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:1px solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background-color:#ff976a;background-color:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:1px solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background-color:#fff;background-color:var(--white,#fff)}.van-button--plain.van-button--primary{color:#07c160;color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:#1989fa;color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:#ee0a24;color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:#ff976a;color:var(--button-warning-background-color,#ff976a)}.van-button--large{width:100%;height:50px;line-height:48px}.van-button--normal{padding:0 15px;font-size:14px}.van-button--small{min-width:60px;height:30px;padding:0 8px;font-size:12px;line-height:28px}.van-button--mini{display:inline-block;width:50px;height:22px;font-size:10px;line-height:20px}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:block;width:100%}.van-button--round{border-radius:10em;border-radius:var(--button-round-border-radius,10em)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5}.van-button__text{display:inline}.van-button__loading-text{display:inline-block;margin-left:5px;vertical-align:middle}.van-button__icon{min-width:1em;line-height:inherit!important;vertical-align:top}.van-button__icon+.van-button__text:not(:empty){display:inline-block;margin-left:5px;vertical-align:top}.van-button--hairline{padding-top:1px;border-width:0}.van-button--hairline:after{border-color:inherit;border-width:1px;border-radius:4px;border-radius:calc(var(--button-border-radius, 2px)*2)}.van-button--hairline.van-button--round:after{border-radius:10em;border-radius:var(--button-round-border-radius,10em)}.van-button--hairline.van-button--square:after{border-radius:0}

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-checkbox{display:-webkit-flex;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{-webkit-flex:none;flex:none}.van-checkbox__icon{display:block;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #e5e5e5;border:1px solid var(--checkbox-border-color,#e5e5e5);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#eee;background-color:var(--checkbox-disabled-background-color,#eee);border-color:#c9c9c9;border-color:var(--checkbox-disabled-icon-color,#c9c9c9)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c9c9c9;color:var(--checkbox-disabled-icon-color,#c9c9c9)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#333;color:var(--checkbox-label-color,#333)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c9c9c9;color:var(--checkbox-disabled-label-color,#c9c9c9)}.van-checkbox__label:empty{margin:0}
@import '../common/index.wxss';.van-checkbox{display:-webkit-flex;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{-webkit-flex:none;flex:none}.van-checkbox__icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #e5e5e5;border:1px solid var(--checkbox-border-color,#e5e5e5);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#eee;background-color:var(--checkbox-disabled-background-color,#eee);border-color:#c9c9c9;border-color:var(--checkbox-disabled-icon-color,#c9c9c9)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c9c9c9;color:var(--checkbox-disabled-icon-color,#c9c9c9)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#333;color:var(--checkbox-label-color,#333)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c9c9c9;color:var(--checkbox-disabled-label-color,#c9c9c9)}.van-checkbox__label:empty{margin:0}

View File

@ -10,7 +10,7 @@ function isObj(x) {
}
exports.isObj = isObj;
function isNumber(value) {
return /^\d+$/.test(value);
return /^\d+(\.\d+)?$/.test(value);
}
exports.isNumber = isNumber;
function range(num, min, max) {

View File

@ -6,6 +6,13 @@ var button_1 = require("../mixins/button");
var open_type_1 = require("../mixins/open-type");
component_1.VantComponent({
mixins: [link_1.link, button_1.button, open_type_1.openType],
relation: {
type: 'ancestor',
name: 'goods-action',
linked: function (parent) {
this.parent = parent;
}
},
props: {
text: String,
color: String,
@ -16,10 +23,31 @@ component_1.VantComponent({
value: 'danger'
}
},
mounted: function () {
this.updateStyle();
},
methods: {
onClick: function (event) {
this.$emit('click', event.detail);
this.jumpLink();
},
updateStyle: function () {
var parent = this.parent;
var _a = parent.children, children = _a === void 0 ? [] : _a;
var index = children.indexOf(this);
var length = children.length;
var isFirst = false;
var isLast = false;
if (index === 0) {
isFirst = true;
}
if (index === length - 1) {
isLast = true;
}
this.setData({
isFirst: isFirst,
isLast: isLast
});
}
}
});

View File

@ -1,3 +1,4 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<van-button
square
id="{{ id }}"
@ -8,7 +9,7 @@
loading="{{ loading }}"
disabled="{{ disabled }}"
open-type="{{ openType }}"
custom-class="custom-class"
custom-class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast }]) }}"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}"

View File

@ -1 +1 @@
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{height:36px!important;font-weight:500!important;font-size:14px!important;line-height:34px!important;border:none!important}.van-goods-action-button--first{display:block!important;width:auto!important;margin-left:5px;border-top-left-radius:18px!important;border-bottom-left-radius:18px!important}.van-goods-action-button--last{display:block!important;width:auto!important;margin-right:5px;border-top-right-radius:18px!important;border-bottom-right-radius:18px!important}.van-goods-action-button--warning{background:linear-gradient(90deg,#ffd01e,#ff8917)}.van-goods-action-button--danger{background:linear-gradient(90deg,#ff6034,#ee0a24)}@media (max-width:321px){.van-goods-action-button{font-size:13px}}

View File

@ -9,6 +9,7 @@ component_1.VantComponent({
mixins: [link_1.link, button_1.button, open_type_1.openType],
props: {
text: String,
dot: Boolean,
info: String,
icon: String,
disabled: Boolean,

View File

@ -22,11 +22,12 @@
bindgetphonenumber="bindGetPhoneNumber"
bindlaunchapp="bindLaunchApp"
>
<view class="van-goods-action-icon__content van-hairline--right">
<view class="van-goods-action-icon__content">
<van-icon
wx:if="{{ icon }}"
size="20px"
name="{{ icon }}"
dot="{{ dot }}"
info="{{ info }}"
class="van-goods-action-icon__icon"
custom-class="icon-class"

View File

@ -1,7 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var safe_area_1 = require("../mixins/safe-area");
component_1.VantComponent({
mixins: [safe_area_1.safeArea()]
relation: {
type: 'descendant',
name: 'goods-action-button',
linked: function (child) {
this.children.push(child);
},
unlinked: function (child) {
this.children = this.children.filter(function (item) { return item !== child; });
}
},
beforeCreate: function () {
this.children = [];
},
props: {
safeAreaInsetBottom: {
type: Boolean,
value: true
}
}
});

View File

@ -1,5 +1,5 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="custom-class {{ utils.bem('goods-action', { safe: isIPhoneX && safeAreaInsetBottom }) }}">
<view class="custom-class {{ utils.bem('goods-action', { safe: safeAreaInsetBottom }) }}">
<slot />
</view>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;background-color:#fff;background-color:var(--white,#fff)}.van-goods-action--safe{padding-bottom:34px;padding-bottom:var(--safe-area-inset-bottom,34px)}
@import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;background-color:#fff;background-color:var(--white,#fff)}.van-goods-action--safe{padding-bottom:env(safe-area-inset-bottom)}

View File

@ -13,6 +13,8 @@ component_1.VantComponent({
mixins: [link_1.link],
props: {
icon: String,
dot: Boolean,
info: null,
text: String,
useSlot: Boolean
},

View File

@ -7,7 +7,7 @@
</block>
<block wx:else>
<view class="van-grid-item__icon">
<van-icon wx:if="{{ icon }}" name="{{ icon }}" />
<van-icon wx:if="{{ icon }}" name="{{ icon }}" dot="{{ dot }}" info="{{ info }}" />
<slot wx:else name="icon"></slot>
</view>
<view class="van-grid-item__text">

View File

@ -1,47 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var cache = null;
function getSafeArea() {
return new Promise(function (resolve, reject) {
if (cache != null) {
resolve(cache);
}
else {
wx.getSystemInfo({
success: function (_a) {
var model = _a.model, screenHeight = _a.screenHeight, statusBarHeight = _a.statusBarHeight;
var iphoneX = /iphone x/i.test(model);
var iphoneNew = /iPhone11/i.test(model) && screenHeight === 812;
cache = {
isIPhoneX: iphoneX || iphoneNew,
statusBarHeight: statusBarHeight
};
resolve(cache);
},
fail: reject
});
}
});
}
exports.safeArea = function (_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.safeAreaInsetBottom, safeAreaInsetBottom = _c === void 0 ? true : _c, _d = _b.safeAreaInsetTop, safeAreaInsetTop = _d === void 0 ? false : _d;
return Behavior({
properties: {
safeAreaInsetTop: {
type: Boolean,
value: safeAreaInsetTop
},
safeAreaInsetBottom: {
type: Boolean,
value: safeAreaInsetBottom
}
},
created: function () {
var _this = this;
getSafeArea().then(function (_a) {
var isIPhoneX = _a.isIPhoneX, statusBarHeight = _a.statusBarHeight;
_this.setData({ isIPhoneX: isIPhoneX, statusBarHeight: statusBarHeight });
});
}
});
};

View File

@ -1,9 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var safe_area_1 = require("../mixins/safe-area");
component_1.VantComponent({
mixins: [safe_area_1.safeArea({ safeAreaInsetTop: true })],
classes: ['title-class'],
props: {
title: String,
@ -18,7 +16,11 @@ component_1.VantComponent({
zIndex: {
type: Number,
value: 1
}
},
safeAreaInsetTop: {
type: Boolean,
value: true
},
},
methods: {
onClickLeft: function () {

View File

@ -1,8 +1,8 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view
class="{{ utils.bem('nav-bar', { fixed }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}"
style="z-index: {{ zIndex }}; {{ safeAreaInsetTop ? 'padding-top: ' + statusBarHeight + 'px;' : '' }}"
class="{{ utils.bem('nav-bar', { fixed, safe: safeAreaInsetTop }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}"
style="z-index: {{ zIndex }};"
>
<view class="van-nav-bar__left" bind:tap="onClickLeft">
<block wx:if="{{ leftArrow || leftText }}">

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--white,#fff)}.van-nav-bar__text{display:inline-block;margin:0 -15px;padding:0 15px;vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-weight:500;font-size:16px}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}
@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--white,#fff)}.van-nav-bar--safe{padding-top:env(safe-area-inset-top)}.van-nav-bar__text{display:inline-block;margin:0 -15px;padding:0 15px;vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-weight:500;font-size:16px}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}

View File

@ -2,9 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var color_1 = require("../common/color");
var safe_area_1 = require("../mixins/safe-area");
component_1.VantComponent({
mixins: [safe_area_1.safeArea()],
props: {
message: String,
background: String,
@ -23,6 +21,10 @@ component_1.VantComponent({
zIndex: {
type: Number,
value: 110
},
safeAreaInsetTop: {
type: Boolean,
value: false
}
},
methods: {

View File

@ -1,10 +1,15 @@
<van-transition
name="slide-down"
show="{{ show }}"
custom-class="van-notify van-notify--{{ type }}"
custom-style="background:{{ background }}; color: {{ color }}; z-index: {{ zIndex }};"
custom-class="van-notify__container"
custom-style="z-index: {{ zIndex }};"
bind:tap="onTap"
>
<view wx:if="{{ safeAreaInsetTop }}" style="padding-top: {{ statusBarHeight }}px"></view>
<text>{{ message }}</text>
<view
class="van-notify van-notify--{{ type }}"
style="background:{{ background }};color:{{ color }};"
>
<view wx:if="{{ safeAreaInsetTop }}" class="van-notify__safe-area"></view>
<text>{{ message }}</text>
</view>
</van-transition>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-notify{position:fixed;top:0;box-sizing:border-box;width:100%;text-align:center;word-wrap:break-word;padding:6px 15px;padding:var(--notify-padding,6px 15px);font-size:14px;font-size:var(--notify-font-size,14px);line-height:20px;line-height:var(--notify-line-height,20px)}.van-notify--primary{background-color:#1989fa;background-color:var(--notify-primary-background-color,#1989fa)}.van-notify--success{background-color:#07c160;background-color:var(--notify-success-background-color,#07c160)}.van-notify--danger{background-color:#ee0a24;background-color:var(--notify-danger-background-color,#ee0a24)}.van-notify--warning{background-color:#ff976a;background-color:var(--notify-warning-background-color,#ff976a)}
@import '../common/index.wxss';.van-notify{text-align:center;word-wrap:break-word;padding:6px 15px;padding:var(--notify-padding,6px 15px);font-size:14px;font-size:var(--notify-font-size,14px);line-height:20px;line-height:var(--notify-line-height,20px)}.van-notify__container{position:fixed;top:0;box-sizing:border-box;width:100%}.van-notify__safe-area{height:constant(safe-area-inset-top);height:env(safe-area-inset-top)}.van-notify--primary{background-color:#1989fa;background-color:var(--notify-primary-background-color,#1989fa)}.van-notify--success{background-color:#07c160;background-color:var(--notify-success-background-color,#07c160)}.van-notify--danger{background-color:#ee0a24;background-color:var(--notify-danger-background-color,#ee0a24)}.van-notify--warning{background-color:#ff976a;background-color:var(--notify-warning-background-color,#ff976a)}

View File

@ -2,7 +2,6 @@
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var transition_1 = require("../mixins/transition");
var safe_area_1 = require("../mixins/safe-area");
component_1.VantComponent({
classes: [
'enter-class',
@ -12,7 +11,7 @@ component_1.VantComponent({
'leave-active-class',
'leave-to-class'
],
mixins: [transition_1.transition(false), safe_area_1.safeArea()],
mixins: [transition_1.transition(false)],
props: {
round: Boolean,
closeable: Boolean,
@ -46,6 +45,14 @@ component_1.VantComponent({
type: String,
value: 'center',
observer: 'observeClass'
},
safeAreaInsetBottom: {
type: Boolean,
value: true
},
safeAreaInsetTop: {
type: Boolean,
value: false
}
},
created: function () {

View File

@ -10,8 +10,8 @@
/>
<view
wx:if="{{ inited }}"
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: isIPhoneX && safeAreaInsetBottom }]) }}"
style="z-index: {{ zIndex }}; -webkit-transition-duration:{{ currentDuration }}ms; transition-duration:{{ currentDuration }}ms; {{ display ? '' : 'display: none;' }} {{ safeAreaInsetTop ? 'padding-top: ' + statusBarHeight + 'px;' : '' }} {{ customStyle }}"
class="custom-class {{ classes }} {{ utils.bem('popup', [position, { round, safe: safeAreaInsetBottom, safeTop: safeAreaInsetTop }]) }}"
style="z-index: {{ zIndex }}; -webkit-transition-duration:{{ currentDuration }}ms; transition-duration:{{ currentDuration }}ms; {{ display ? '' : 'display: none;' }};{{ customStyle }}"
bind:transitionend="onTransitionEnd"
>
<slot />

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-popup{position:fixed;top:50%;left:50%;box-sizing:border-box;max-height:100%;overflow-y:auto;transition-timing-function:ease;-webkit-animation:ease both;animation:ease both;-webkit-overflow-scrolling:touch;background-color:#fff;background-color:var(--white,#fff)}.van-popup--center{-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup--center.van-popup--round{border-radius:12px;border-radius:var(--popup-round-border-radius,12px)}.van-popup--top{top:0;right:auto;bottom:auto;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--top.van-popup--round{border-radius:0 0 12px 12px;border-radius:0 0 var(--popup-round-border-radius,12px) var(--popup-round-border-radius,12px)}.van-popup--right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--right.van-popup--round{border-radius:12px 0 0 12px;border-radius:var(--popup-round-border-radius,12px) 0 0 var(--popup-round-border-radius,12px)}.van-popup--bottom{top:auto;right:auto;bottom:0;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--bottom.van-popup--round{border-radius:12px 12px 0 0;border-radius:var(--popup-round-border-radius,12px) var(--popup-round-border-radius,12px) 0 0}.van-popup--left{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--left.van-popup--round{border-radius:0 12px 12px 0;border-radius:0 var(--popup-round-border-radius,12px) var(--popup-round-border-radius,12px) 0}.van-popup--bottom.van-popup--safe{padding-bottom:34px;padding-bottom:var(--safe-area-inset-bottom,34px)}.van-popup__close-icon{position:absolute;z-index:1;z-index:var(--popup-close-icon-z-index,1);color:#999;color:var(--popup-close-icon-color,#999);font-size:18px;font-size:var(--popup-close-icon-size,18px)}.van-popup__close-icon--top-left{top:16px;top:var(--popup-close-icon-margin,16px);left:16px;left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--top-right{top:16px;top:var(--popup-close-icon-margin,16px);right:16px;right:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-left{bottom:16px;bottom:var(--popup-close-icon-margin,16px);left:16px;left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-right{right:16px;right:var(--popup-close-icon-margin,16px);bottom:16px;bottom:var(--popup-close-icon-margin,16px)}.van-popup__close-icon:active{opacity:.6}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.van-scale-enter,.van-scale-leave-to{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-bottom-enter,.van-bottom-leave-to{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}.van-top-enter,.van-top-leave-to{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}.van-left-enter,.van-left-leave-to{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}
@import '../common/index.wxss';.van-popup{position:fixed;top:50%;left:50%;box-sizing:border-box;max-height:100%;overflow-y:auto;transition-timing-function:ease;-webkit-animation:ease both;animation:ease both;-webkit-overflow-scrolling:touch;background-color:#fff;background-color:var(--white,#fff)}.van-popup--center{-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0)}.van-popup--center.van-popup--round{border-radius:20px;border-radius:var(--popup-round-border-radius,20px)}.van-popup--top{top:0;right:auto;bottom:auto;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--top.van-popup--round{border-radius:0 0 20px 20px;border-radius:0 0 var(--popup-round-border-radius,20px) var(--popup-round-border-radius,20px)}.van-popup--right{top:50%;right:0;bottom:auto;left:auto;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--right.van-popup--round{border-radius:20px 0 0 20px;border-radius:var(--popup-round-border-radius,20px) 0 0 var(--popup-round-border-radius,20px)}.van-popup--bottom{top:auto;right:auto;bottom:0;left:50%;width:100%;-webkit-transform:translate3d(-50%,0,0);transform:translate3d(-50%,0,0)}.van-popup--bottom.van-popup--round{border-radius:20px 20px 0 0;border-radius:var(--popup-round-border-radius,20px) var(--popup-round-border-radius,20px) 0 0}.van-popup--left{top:50%;right:auto;bottom:auto;left:0;-webkit-transform:translate3d(0,-50%,0);transform:translate3d(0,-50%,0)}.van-popup--left.van-popup--round{border-radius:0 20px 20px 0;border-radius:0 var(--popup-round-border-radius,20px) var(--popup-round-border-radius,20px) 0}.van-popup--bottom.van-popup--safe{padding-bottom:env(safe-area-inset-bottom)}.van-popup--safeTop{padding-top:env(safe-area-inset-top)}.van-popup__close-icon{position:absolute;z-index:1;z-index:var(--popup-close-icon-z-index,1);color:#999;color:var(--popup-close-icon-color,#999);font-size:18px;font-size:var(--popup-close-icon-size,18px)}.van-popup__close-icon--top-left{top:16px;top:var(--popup-close-icon-margin,16px);left:16px;left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--top-right{top:16px;top:var(--popup-close-icon-margin,16px);right:16px;right:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-left{bottom:16px;bottom:var(--popup-close-icon-margin,16px);left:16px;left:var(--popup-close-icon-margin,16px)}.van-popup__close-icon--bottom-right{right:16px;right:var(--popup-close-icon-margin,16px);bottom:16px;bottom:var(--popup-close-icon-margin,16px)}.van-popup__close-icon:active{opacity:.6}.van-scale-enter-active,.van-scale-leave-active{transition-property:opacity,-webkit-transform;transition-property:opacity,transform;transition-property:opacity,transform,-webkit-transform}.van-scale-enter,.van-scale-leave-to{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-fade-enter-active,.van-fade-leave-active{transition-property:opacity}.van-fade-enter,.van-fade-leave-to{opacity:0}.van-center-enter-active,.van-center-leave-active{transition-property:opacity}.van-center-enter,.van-center-leave-to{opacity:0}.van-bottom-enter-active,.van-bottom-leave-active,.van-left-enter-active,.van-left-leave-active,.van-right-enter-active,.van-right-leave-active,.van-top-enter-active,.van-top-leave-active{transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-bottom-enter,.van-bottom-leave-to{-webkit-transform:translate3d(-50%,100%,0);transform:translate3d(-50%,100%,0)}.van-top-enter,.van-top-leave-to{-webkit-transform:translate3d(-50%,-100%,0);transform:translate3d(-50%,-100%,0)}.van-left-enter,.van-left-leave-to{-webkit-transform:translate3d(-100%,-50%,0);transform:translate3d(-100%,-50%,0)}.van-right-enter,.van-right-leave-to{-webkit-transform:translate3d(100%,-50%,0);transform:translate3d(100%,-50%,0)}

View File

@ -95,16 +95,11 @@ component_1.VantComponent({
var touchable = this.data.touchable;
if (!touchable)
return;
var _a = event.touches[0], clientX = _a.clientX, clientY = _a.clientY;
var clientX = event.touches[0].clientX;
this.getRect('.van-rate__icon', true).then(function (list) {
var target = list
.sort(function (item) { return item.right - item.left; })
.find(function (item) {
return clientX >= item.left &&
clientX <= item.right &&
clientY >= item.top &&
clientY <= item.bottom;
});
.find(function (item) { return clientX >= item.left && clientX <= item.right; });
if (target != null) {
_this.onSelect(__assign(__assign({}, event), { currentTarget: target }));
}

View File

@ -15,6 +15,7 @@ component_1.VantComponent({
buttonSize: null,
asyncChange: Boolean,
disableInput: Boolean,
decimalLength: Number,
min: {
type: null,
value: 1
@ -86,7 +87,14 @@ component_1.VantComponent({
// limit value range
range: function (value) {
value = String(value).replace(/[^0-9.-]/g, '');
return Math.max(Math.min(this.data.max, value), this.data.min);
// format range
value = value === '' ? 0 : +value;
value = Math.max(Math.min(this.data.max, value), this.data.min);
// format decimal
if (utils_1.isDef(this.data.decimalLength)) {
value = value.toFixed(this.data.decimalLength);
}
return value;
},
onInput: function (event) {
var _a = (event.detail || {}).value, value = _a === void 0 ? '' : _a;
@ -99,7 +107,10 @@ component_1.VantComponent({
return;
}
var diff = type === 'minus' ? -this.data.step : +this.data.step;
var value = Math.round((+this.data.value + diff) * 100) / 100;
var value = +this.data.value + diff;
if (!utils_1.isDef(this.data.decimalLength)) {
value = Math.round(value * 100) / 100;
}
this.triggerInput(this.range(value));
this.$emit(type);
},

View File

@ -1,9 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var safe_area_1 = require("../mixins/safe-area");
component_1.VantComponent({
mixins: [safe_area_1.safeArea()],
classes: [
'bar-class',
'price-class',
@ -37,7 +35,11 @@ component_1.VantComponent({
value: 2,
observer: 'updatePrice'
},
suffixLabel: String
suffixLabel: String,
safeAreaInsetBottom: {
type: Boolean,
value: true
}
},
methods: {
updatePrice: function () {

View File

@ -16,7 +16,7 @@
<slot name="tip" />
</view>
<view class="bar-class {{ utils.bem('submit-bar__bar', { safe: safeAreaInsetBottom && isIPhoneX }) }}">
<view class="bar-class {{ utils.bem('submit-bar__bar', { safe: safeAreaInsetBottom }) }}">
<slot />
<view wx:if="{{ hasPrice }}" class="van-submit-bar__text">
<text>{{ label || '合计:' }}</text>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-submit-bar{position:fixed;bottom:0;left:0;width:100%;-webkit-user-select:none;user-select:none;z-index:100;z-index:var(--submit-bar-z-index,100)}.van-submit-bar__tip{padding:10px;padding:var(--submit-bar-tip-padding,10px);color:#f56723;color:var(--submit-bar-tip-color,#f56723);font-size:12px;font-size:var(--submit-bar-tip-font-size,12px);line-height:1.5;line-height:var(--submit-bar-tip-line-height,1.5);background-color:#fff7cc;background-color:var(--submit-bar-tip-background-color,#fff7cc)}.van-submit-bar__tip:empty{display:none}.van-submit-bar__tip-icon{width:12px;height:12px;margin-right:4px;vertical-align:middle}.van-submit-bar__tip-text{display:inline;vertical-align:middle}.van-submit-bar__bar{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:flex-end;justify-content:flex-end;height:50px;height:var(--submit-bar-height,50px);font-size:14px;font-size:var(--submit-bar-text-font-size,14px);background-color:#fff;background-color:var(--submit-bar-background-color,#fff)}.van-submit-bar__bar--safe{padding-bottom:34px;padding-bottom:var(--safe-area-inset-bottom,34px)}.van-submit-bar__text{-webkit-flex:1;flex:1;padding-right:12px;font-weight:500;text-align:right;color:#333;color:var(--submit-bar-text-color,#333)}.van-submit-bar__price{color:#ee0a24;color:var(--submit-bar-price-color,#ee0a24);font-size:18px;font-size:var(--submit-bar-price-font-size,18px)}.van-submit-bar__currency{font-size:14px;font-size:var(--submit-bar-currency-font-size,14px)}.van-submit-bar__suffix-label{margin-left:5px}.van-submit-bar__button{width:110px;width:var(--submit-bar-button-width,110px)}
@import '../common/index.wxss';.van-submit-bar{position:fixed;bottom:0;left:0;width:100%;-webkit-user-select:none;user-select:none;z-index:100;z-index:var(--submit-bar-z-index,100)}.van-submit-bar__tip{padding:10px;padding:var(--submit-bar-tip-padding,10px);color:#f56723;color:var(--submit-bar-tip-color,#f56723);font-size:12px;font-size:var(--submit-bar-tip-font-size,12px);line-height:1.5;line-height:var(--submit-bar-tip-line-height,1.5);background-color:#fff7cc;background-color:var(--submit-bar-tip-background-color,#fff7cc)}.van-submit-bar__tip:empty{display:none}.van-submit-bar__tip-icon{width:12px;height:12px;margin-right:4px;vertical-align:middle}.van-submit-bar__tip-text{display:inline;vertical-align:middle}.van-submit-bar__bar{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:flex-end;justify-content:flex-end;height:50px;height:var(--submit-bar-height,50px);font-size:14px;font-size:var(--submit-bar-text-font-size,14px);background-color:#fff;background-color:var(--submit-bar-background-color,#fff)}.van-submit-bar__bar--safe{padding-bottom:env(safe-area-inset-bottom)}.van-submit-bar__text{-webkit-flex:1;flex:1;padding-right:12px;font-weight:500;text-align:right;color:#333;color:var(--submit-bar-text-color,#333)}.van-submit-bar__price{color:#ee0a24;color:var(--submit-bar-price-color,#ee0a24);font-size:18px;font-size:var(--submit-bar-price-font-size,18px)}.van-submit-bar__currency{font-size:14px;font-size:var(--submit-bar-currency-font-size,14px)}.van-submit-bar__suffix-label{margin-left:5px}.van-submit-bar__button{width:110px;width:var(--submit-bar-button-width,110px)}

View File

@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var touch_1 = require("../mixins/touch");
var THRESHOLD = 0.3;
var ARRAY = [];
component_1.VantComponent({
props: {
disabled: Boolean,
@ -26,6 +27,11 @@ component_1.VantComponent({
},
created: function () {
this.offset = 0;
ARRAY.push(this);
},
destroyed: function () {
var _this = this;
ARRAY = ARRAY.filter(function (item) { return item !== _this; });
},
methods: {
open: function (position) {
@ -62,9 +68,15 @@ component_1.VantComponent({
this.setData({ catchMove: false });
},
startDrag: function (event) {
var _this = this;
if (this.data.disabled) {
return;
}
ARRAY.forEach(function (item) {
if (item !== _this) {
item.close();
}
});
this.draging = true;
this.startOffset = this.offset;
this.firstDirection = '';

View File

@ -11,7 +11,12 @@ component_1.VantComponent({
info: null,
title: String,
disabled: Boolean,
titleStyle: String
titleStyle: String,
name: {
type: [Number, String],
value: '',
observer: 'setComputedName'
}
},
data: {
width: null,
@ -27,6 +32,9 @@ component_1.VantComponent({
titleStyle: 'update'
},
methods: {
setComputedName: function () {
this.computedName = this.data.name || this.index;
},
update: function () {
var parent = this.getRelationNodes('../tabs/index')[0];
if (parent) {

View File

@ -1,9 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component");
var safe_area_1 = require("../mixins/safe-area");
component_1.VantComponent({
mixins: [safe_area_1.safeArea()],
relation: {
name: 'tabbar-item',
type: 'descendant',
@ -41,6 +39,10 @@ component_1.VantComponent({
zIndex: {
type: Number,
value: 1
},
safeAreaInsetBottom: {
type: Boolean,
value: true
}
},
beforeCreate: function () {

View File

@ -1,7 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view
class="custom-class {{ border ? 'van-hairline--top-bottom' : '' }} {{ utils.bem('tabbar', { fixed, safe: isIPhoneX && safeAreaInsetBottom }) }}"
class="custom-class {{ border ? 'van-hairline--top-bottom' : '' }} {{ utils.bem('tabbar', { fixed, safe: safeAreaInsetBottom }) }}"
style="{{ zIndex ? 'z-index: ' + zIndex : '' }}"
>
<slot />

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-tabbar{display:-webkit-flex;display:flex;width:100%;height:50px;background-color:#fff;background-color:var(--white,#fff)}.van-tabbar--fixed{position:fixed;bottom:0;left:0}.van-tabbar--safe{padding-bottom:34px;padding-bottom:var(--safe-area-inset-bottom,34px)}
@import '../common/index.wxss';.van-tabbar{display:-webkit-flex;display:flex;width:100%;height:50px;background-color:#fff;background-color:var(--white,#fff)}.van-tabbar--fixed{position:fixed;bottom:0;left:0}.van-tabbar--safe{padding-bottom:env(safe-area-inset-bottom)}

View File

@ -10,14 +10,23 @@ component_1.VantComponent({
name: 'tab',
type: 'descendant',
linked: function (child) {
this.child.push(child);
child.index = this.children.length;
child.setComputedName();
this.children.push(child);
this.updateTabs(this.data.tabs.concat(child.data));
},
unlinked: function (child) {
var index = this.child.indexOf(child);
var index = this.children.indexOf(child);
var tabs = this.data.tabs;
tabs.splice(index, 1);
this.child.splice(index, 1);
this.children.splice(index, 1);
var i = index;
while (i >= 0 && i < this.children.length) {
var currentChild = this.children[i];
currentChild.index--;
currentChild.setComputedName();
i++;
}
this.updateTabs(tabs);
}
},
@ -27,16 +36,16 @@ component_1.VantComponent({
animated: Boolean,
swipeable: Boolean,
lineWidth: {
type: Number,
type: [String, Number],
value: -1
},
lineHeight: {
type: Number,
type: [String, Number],
value: -1
},
active: {
type: Number,
value: 0
type: [String, Number],
value: 0,
},
type: {
type: String,
@ -70,12 +79,13 @@ component_1.VantComponent({
scrollable: false,
trackStyle: '',
wrapStyle: '',
position: ''
position: '',
currentIndex: null,
},
watch: {
swipeThreshold: function () {
this.setData({
scrollable: this.child.length > this.data.swipeThreshold
scrollable: this.children.length > this.data.swipeThreshold
});
},
color: 'setLine',
@ -86,7 +96,7 @@ component_1.VantComponent({
offsetTop: 'setWrapStyle'
},
beforeCreate: function () {
this.child = [];
this.children = [];
},
mounted: function () {
var _this = this;
@ -111,26 +121,28 @@ component_1.VantComponent({
});
this.setActiveTab();
},
trigger: function (eventName, index) {
trigger: function (eventName, name) {
var _a = this.data, tabs = _a.tabs, currentIndex = _a.currentIndex;
this.$emit(eventName, {
index: index,
title: this.data.tabs[index].title
name: name,
title: tabs[currentIndex].title
});
},
onTap: function (event) {
var index = event.currentTarget.dataset.index;
var child = this.children[index];
if (this.data.tabs[index].disabled) {
this.trigger('disabled', index);
this.trigger('disabled', child.computedName);
}
else {
this.trigger('click', index);
this.setActive(index);
this.trigger('click', child.computedName);
this.setActive(child.computedName);
}
},
setActive: function (active) {
if (active !== this.data.active) {
this.trigger('change', active);
this.setData({ active: active });
setActive: function (computedName) {
if (computedName !== this.currentName) {
this.currentName = computedName;
this.trigger('change', computedName);
this.setActiveTab();
}
},
@ -139,46 +151,52 @@ component_1.VantComponent({
if (this.data.type !== 'line') {
return;
}
var _a = this.data, color = _a.color, active = _a.active, duration = _a.duration, lineWidth = _a.lineWidth, lineHeight = _a.lineHeight;
var _a = this.data, color = _a.color, duration = _a.duration, currentIndex = _a.currentIndex, lineWidth = _a.lineWidth, lineHeight = _a.lineHeight;
this.getRect('.van-tab', true).then(function (rects) {
var rect = rects[active];
var rect = rects[currentIndex];
var width = lineWidth !== -1 ? lineWidth : rect.width / 2;
var height = lineHeight !== -1 ? "height: " + lineHeight + "px;" : '';
var height = lineHeight !== -1 ? "height: " + utils_1.addUnit(lineHeight) + "; border-radius: " + utils_1.addUnit(lineHeight) + ";" : '';
var left = rects
.slice(0, active)
.slice(0, currentIndex)
.reduce(function (prev, curr) { return prev + curr.width; }, 0);
left += (rect.width - width) / 2;
var transition = skipTransition
? ''
: "transition-duration: " + duration + "s; -webkit-transition-duration: " + duration + "s;";
_this.setData({
lineStyle: "\n " + height + "\n width: " + width + "px;\n background-color: " + color + ";\n -webkit-transform: translateX(" + left + "px);\n transform: translateX(" + left + "px);\n " + transition + "\n "
lineStyle: "\n " + height + "\n width: " + utils_1.addUnit(width) + ";\n background-color: " + color + ";\n -webkit-transform: translateX(" + left + "px);\n transform: translateX(" + left + "px);\n " + transition + "\n "
});
});
},
setTrack: function () {
var _this = this;
var _a = this.data, animated = _a.animated, active = _a.active, duration = _a.duration;
var _a = this.data, animated = _a.animated, duration = _a.duration, currentIndex = _a.currentIndex;
if (!animated)
return '';
this.getRect('.van-tabs__content').then(function (rect) {
var width = rect.width;
_this.setData({
trackStyle: "\n width: " + width * _this.child.length + "px;\n left: " + -1 * active * width + "px;\n transition: left " + duration + "s;\n display: -webkit-box;\n display: flex;\n "
trackStyle: "\n width: " + width * _this.children.length + "px;\n left: " + -1 * currentIndex * width + "px;\n transition: left " + duration + "s;\n display: -webkit-box;\n display: flex;\n "
});
var data = { width: width, animated: animated };
_this.child.forEach(function (item) {
_this.children.forEach(function (item) {
item.setData(data);
});
});
},
setActiveTab: function () {
var _this = this;
this.child.forEach(function (item, index) {
if (!utils_1.isDef(this.currentName)) {
this.currentName = this.data.active || this.children[0].computedName;
}
this.children.forEach(function (item, index) {
var data = {
active: index === _this.data.active
active: item.computedName === _this.currentName
};
if (data.active) {
_this.setData({
currentIndex: index
});
data.inited = true;
}
if (data.active !== item.data.active) {
@ -194,7 +212,7 @@ component_1.VantComponent({
// scroll active tab into view
scrollIntoView: function () {
var _this = this;
var _a = this.data, active = _a.active, scrollable = _a.scrollable;
var _a = this.data, currentIndex = _a.currentIndex, scrollable = _a.scrollable;
if (!scrollable) {
return;
}
@ -203,9 +221,9 @@ component_1.VantComponent({
this.getRect('.van-tabs__nav')
]).then(function (_a) {
var tabRects = _a[0], navRect = _a[1];
var tabRect = tabRects[active];
var tabRect = tabRects[currentIndex];
var offsetLeft = tabRects
.slice(0, active)
.slice(0, currentIndex)
.reduce(function (prev, curr) { return prev + curr.width; }, 0);
_this.setData({
scrollLeft: offsetLeft - (navRect.width - tabRect.width) / 2
@ -226,15 +244,15 @@ component_1.VantComponent({
onTouchEnd: function () {
if (!this.data.swipeable)
return;
var _a = this.data, active = _a.active, tabs = _a.tabs;
var _a = this.data, tabs = _a.tabs, currentIndex = _a.currentIndex;
var _b = this, direction = _b.direction, deltaX = _b.deltaX, offsetX = _b.offsetX;
var minSwipeDistance = 50;
if (direction === 'horizontal' && offsetX >= minSwipeDistance) {
if (deltaX > 0 && active !== 0) {
this.setActive(active - 1);
if (deltaX > 0 && currentIndex !== 0) {
this.setActive(this.children[currentIndex - 1].computedName);
}
else if (deltaX < 0 && active !== tabs.length - 1) {
this.setActive(active + 1);
else if (deltaX < 0 && currentIndex !== tabs.length - 1) {
this.setActive(this.children[currentIndex + 1].computedName);
}
}
},

View File

@ -17,15 +17,16 @@
wx:for="{{ tabs }}"
wx:key="index"
data-index="{{ index }}"
class="van-ellipsis tab-class {{ index === active ? 'tab-active-class' : '' }} {{ utils.bem('tab', { active: index === active, disabled: item.disabled }) }}"
style="{{ color && index !== active && type === 'card' && !item.disabled ? 'color: ' + color : '' }} {{ color && index === active && type === 'card' ? ';background-color:' + color : '' }} {{ color ? ';border-color: ' + color : '' }} {{ scrollable ? ';flex-basis:' + (88 / swipeThreshold) + '%' : '' }}"
class="van-ellipsis tab-class {{ index === currentIndex ? 'tab-active-class' : '' }} {{ utils.bem('tab', { active: index === currentIndex, disabled: item.disabled }) }}"
style="{{ color && index !== currentIndex && type === 'card' && !item.disabled ? 'color: ' + color : '' }} {{ color && index === currentIndex && type === 'card' ? ';background-color:' + color : '' }} {{ color ? ';border-color: ' + color : '' }} {{ scrollable ? ';flex-basis:' + (88 / swipeThreshold) + '%' : '' }}"
bind:tap="onTap"
>
<view class="van-ellipsis {{ utils.bem('tab__title', { dot: item.dot }) }}" style="{{ item.titleStyle }}">
<view class="van-ellipsis" style="{{ item.titleStyle }}">
{{ item.title }}
<van-info
wx:if="{{ item.info !== null }}"
wx:if="{{ item.info !== null || item.dot }}"
info="{{ item.info }}"
dot="{{ item.dot }}"
custom-class="van-tab__title__info"
/>
</view>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{position:absolute;top:0;right:0;left:0;display:-webkit-flex;display:flex;background-color:#fff;background-color:var(--white,#fff)}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__scroll--card{border-radius:2px;border:1px solid #ee0a24;border:1px solid var(--red,#ee0a24)}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--line{height:100%}.van-tabs__nav--card{height:30px;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{color:#ee0a24;color:var(--red,#ee0a24);line-height:30px;line-height:var(--tabs-card-height,30px);border-right:1px solid #ee0a24;border-right:1px solid var(--red,#ee0a24)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;color:var(--white,#fff);background-color:#ee0a24;background-color:var(--red,#ee0a24)}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;border-radius:3px;background-color:#ee0a24;background-color:var(--red,#ee0a24)}.van-tabs--line{padding-top:44px;padding-top:var(--tabs-line-height,44px)}.van-tabs--line .van-tabs__wrap{height:44px;height:var(--tabs-line-height,44px)}.van-tabs--card{margin:0 15px;padding-top:30px;padding-top:var(--tabs-card-height,30px)}.van-tabs--card .van-tabs__wrap{height:30px;height:var(--tabs-card-height,30px)}.van-tabs__content{overflow:hidden}.van-tab,.van-tabs__track{position:relative}.van-tab{-webkit-flex:1;flex:1;box-sizing:border-box;min-width:0;padding:0 5px;font-size:14px;text-align:center;cursor:pointer;color:#7d7e80;color:var(--gray-darker,#7d7e80);line-height:44px;line-height:var(--tabs-line-height,44px)}.van-tab--active{font-weight:500;color:#333;color:var(--text-color,#333)}.van-tab--disabled{color:#c9c9c9;color:var(--gray,#c9c9c9)}.van-tab__title--dot:after{display:inline-block;width:8px;height:8px;vertical-align:middle;border-radius:100%;content:"";background-color:#ee0a24;background-color:var(--red,#ee0a24)}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{position:absolute;top:0;right:0;left:0;display:-webkit-flex;display:flex;background-color:#fff;background-color:var(--white,#fff)}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__scroll--card{border-radius:2px;border:1px solid #ee0a24;border:1px solid var(--red,#ee0a24)}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--line{height:100%}.van-tabs__nav--card{height:30px;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{color:#ee0a24;color:var(--red,#ee0a24);line-height:30px;line-height:var(--tabs-card-height,30px);border-right:1px solid #ee0a24;border-right:1px solid var(--red,#ee0a24)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;color:var(--white,#fff);background-color:#ee0a24;background-color:var(--red,#ee0a24)}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;border-radius:3px;background-color:#ee0a24;background-color:var(--red,#ee0a24)}.van-tabs--line{padding-top:44px;padding-top:var(--tabs-line-height,44px)}.van-tabs--line .van-tabs__wrap{height:44px;height:var(--tabs-line-height,44px)}.van-tabs--card{margin:0 15px;padding-top:30px;padding-top:var(--tabs-card-height,30px)}.van-tabs--card .van-tabs__wrap{height:30px;height:var(--tabs-card-height,30px)}.van-tabs__content{overflow:hidden}.van-tab,.van-tabs__track{position:relative}.van-tab{-webkit-flex:1;flex:1;box-sizing:border-box;min-width:0;padding:0 5px;font-size:14px;text-align:center;cursor:pointer;color:#7d7e80;color:var(--gray-darker,#7d7e80);line-height:44px;line-height:var(--tabs-line-height,44px)}.van-tab--active{font-weight:500;color:#333;color:var(--text-color,#333)}.van-tab--disabled{color:#c9c9c9;color:var(--gray,#c9c9c9)}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}