build: compile 1.0.6

This commit is contained in:
rex-zsd 2020-02-24 09:50:40 +08:00
parent dcd3665570
commit a391c319c9
99 changed files with 457 additions and 347 deletions

View File

@ -5,7 +5,7 @@ VantComponent({
mixins: [button, openType],
classes: ['hover-class', 'loading-class'],
data: {
style: ''
baseStyle: ''
},
props: {
icon: String,
@ -52,8 +52,8 @@ VantComponent({
style += `border-color: ${color};`;
}
}
if (style !== this.data.style) {
this.setData({ style });
if (style !== this.data.baseStyle) {
this.setData({ baseStyle: style });
}
}
}

View File

@ -5,7 +5,7 @@
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
hover-class="van-button--active hover-class"
lang="{{ lang }}"
style="{{ style }} {{ customStyle }}"
style="{{ baseStyle }} {{ customStyle }}"
open-type="{{ openType }}"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
@ -28,7 +28,7 @@
custom-class="loading-class"
size="{{ loadingSize }}"
type="{{ loadingType }}"
color="{{ type === 'default' ? '#c9c9c9' : 'white' }}"
color="{{ loadingColor(type,color,plain) }}"
/>
<view
wx:if="{{ loadingText }}"
@ -50,3 +50,19 @@
</view>
</block>
</button>
<wxs module="loadingColor">
function get(type, color,plain) {
if(plain) {
return color ? color: '#c9c9c9';
}
if(type === 'default') {
return '#c9c9c9';
}
return 'white';
}
module.exports = get;
</wxs>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-button{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:0;line-height:20px;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%;height:44px;height:var(--button-default-height,44px);font-size:16px;font-size:var(--button-default-font-size,16px);transition:opacity .2s;transition:opacity var(--animation-duration-fast,.2s);border-radius:2px;border-radius:var(--button-border-radius,2px)}.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:#323233;color:var(--button-default-color,#323233);background-color:#fff;background-color:var(--button-default-background-color,#fff);border:1px solid #ebedf0;border:1px solid var(--button-default-border-color,#ebedf0)}.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(--button-plain-background-color,#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;height:var(--button-large-height,50px)}.van-button--normal{padding:0 15px;font-size:14px;font-size:var(--button-normal-font-size,14px)}.van-button--small{min-width:60px;min-width:var(--button-small-min-width,60px);height:30px;height:var(--button-small-height,30px);padding:0 8px;padding:0 var(--padding-xs,8px);font-size:12px;font-size:var(--button-small-font-size,12px)}.van-button--mini{display:inline-block;min-width:50px;min-width:var(--button-mini-min-width,50px);height:22px;height:var(--button-mini-height,22px);font-size:10px;font-size:var(--button-mini-font-size,10px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:-webkit-flex;display:flex;width:100%}.van-button--round{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5;opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{min-width:1em;line-height:inherit!important;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:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0}
@import '../common/index.wxss';.van-button{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:0;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%;height:44px;height:var(--button-default-height,44px);line-height:20px;line-height:var(--button-line-height,20px);font-size:16px;font-size:var(--button-default-font-size,16px);transition:opacity .2s;transition:opacity var(--animation-duration-fast,.2s);border-radius:2px;border-radius:var(--button-border-radius,2px)}.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:#323233;color:var(--button-default-color,#323233);background:#fff;background:var(--button-default-background-color,#fff);border:1px solid #ebedf0;border:var(--button-border-width,1px) solid var(--button-default-border-color,#ebedf0)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background:#07c160;background:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:var(--button-border-width,1px) solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background:#1989fa;background:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:var(--button-border-width,1px) solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background:#ee0a24;background:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:var(--button-border-width,1px) solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background:#ff976a;background:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:var(--button-border-width,1px) solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background:#fff;background:var(--button-plain-background-color,#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;height:var(--button-large-height,50px)}.van-button--normal{padding:0 15px;font-size:14px;font-size:var(--button-normal-font-size,14px)}.van-button--small{min-width:60px;min-width:var(--button-small-min-width,60px);height:30px;height:var(--button-small-height,30px);padding:0 8px;padding:0 var(--padding-xs,8px);font-size:12px;font-size:var(--button-small-font-size,12px)}.van-button--mini{display:inline-block;min-width:50px;min-width:var(--button-mini-min-width,50px);height:22px;height:var(--button-mini-height,22px);font-size:10px;font-size:var(--button-mini-font-size,10px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:-webkit-flex;display:flex;width:100%}.van-button--round{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5;opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{min-width:1em;line-height:inherit!important;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:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0}

13
dist/card/index.js vendored
View File

@ -16,7 +16,10 @@ VantComponent({
desc: String,
thumb: String,
title: String,
price: String,
price: {
type: String,
observer: 'updatePrice'
},
centered: Boolean,
lazyLoad: Boolean,
thumbLink: String,
@ -31,6 +34,14 @@ VantComponent({
}
},
methods: {
updatePrice() {
const { price } = this.data;
const priceArr = price.toString().split('.');
this.setData({
integerStr: priceArr[0],
decimalStr: priceArr[1] ? `.${priceArr[1]}` : '',
});
},
onClickThumb() {
this.jumpLink('thumbLink');
}

17
dist/card/index.wxml vendored
View File

@ -21,17 +21,20 @@
</van-tag>
</view>
<view class="van-card__content">
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
<slot wx:else name="title" />
<view class="van-card__content {{ utils.bem('card__content', { center: centered }) }}">
<view>
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
<slot wx:else name="title" />
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
<slot wx:else name="desc" />
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
<slot wx:else name="desc" />
<slot name="tags" />
<slot name="tags" />
</view>
<view class="van-card__bottom">
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
<slot name="price-top" />
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }}<text class="van-card__price-integer">{{ integerStr }}</text><text class="van-card__price-decimal">{{ decimalStr }}</text></view>
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
<slot name="bottom" />

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-card{position:relative;box-sizing:border-box;padding:8px 16px;padding:var(--card-padding,8px 16px);font-size:12px;font-size:var(--card-font-size,12px);color:#323233;color:var(--card-text-color,#323233);background-color:#fafafa;background-color:var(--card-background-color,#fafafa)}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;-webkit-flex:none;flex:none;width:90px;width:var(--card-thumb-size,90px);height:90px;height:var(--card-thumb-size,90px);margin-right:8px;margin-right:var(--padding-xs,8px)}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%}.van-card__content{position:relative;-webkit-flex:1;flex:1;min-width:0}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:16px;line-height:var(--card-title-line-height,16px)}.van-card__desc{line-height:20px;line-height:var(--card-desc-line-height,20px);color:#646566;color:var(--card-desc-color,#646566)}.van-card__bottom{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#ee0a24;color:var(--card-price-color,#ee0a24)}.van-card__origin-price{display:inline-block;margin-left:5px;text-decoration:line-through;font-size:10px;font-size:var(--card-origin-price-font-size,10px);color:#646566;color:var(--card-origin-price-color,#646566)}.van-card__num{float:right}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{-webkit-flex:none;flex:none;width:100%;text-align:right}
@import '../common/index.wxss';.van-card{position:relative;box-sizing:border-box;padding:8px 16px;padding:var(--card-padding,8px 16px);font-size:12px;font-size:var(--card-font-size,12px);color:#323233;color:var(--card-text-color,#323233);background-color:#fafafa;background-color:var(--card-background-color,#fafafa)}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;-webkit-flex:none;flex:none;width:88px;width:var(--card-thumb-size,88px);height:88px;height:var(--card-thumb-size,88px);margin-right:8px;margin-right:var(--padding-xs,8px)}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%;border-radius:8px;border-radius:var(--border-radius-lg,8px)}.van-card__content{position:relative;display:-webkit-flex;display:flex;-webkit-flex:1;flex:1;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:space-between;justify-content:space-between;min-width:0;min-height:88px;min-height:var(--card-thumb-size,88px)}.van-card__content--center{-webkit-justify-content:center;justify-content:center}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:16px;line-height:var(--card-title-line-height,16px)}.van-card__desc{line-height:20px;line-height:var(--card-desc-line-height,20px);color:#646566;color:var(--card-desc-color,#646566)}.van-card__bottom{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#ee0a24;color:var(--card-price-color,#ee0a24);font-size:12px;font-size:var(--card-price-font-size,12px)}.van-card__price-integer{font-size:16px;font-size:var(--card-price-integer-font-size,16px)}.van-card__price-decimal,.van-card__price-integer{font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif;font-family:var(--card-price-font-family,Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif)}.van-card__origin-price{display:inline-block;margin-left:5px;text-decoration:line-through;font-size:10px;font-size:var(--card-origin-price-font-size,10px);color:#646566;color:var(--card-origin-price-color,#646566)}.van-card__num{float:right}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{-webkit-flex:none;flex:none;width:100%;text-align:right}

View File

@ -4,14 +4,10 @@ VantComponent({
relation: {
name: 'checkbox',
type: 'descendant',
current: 'checkbox-group',
linked(target) {
this.children = this.children || [];
this.children.push(target);
this.updateChild(target);
},
unlinked(target) {
this.children = this.children.filter((child) => child !== target);
}
},
props: {
max: Number,
@ -32,7 +28,7 @@ VantComponent({
const { value, disabled } = this.data;
child.setData({
value: value.indexOf(child.data.name) !== -1,
disabled: disabled || child.data.disabled
parentDisabled: disabled
});
}
}

View File

@ -8,12 +8,7 @@ VantComponent({
relation: {
name: 'checkbox-group',
type: 'ancestor',
linked(target) {
this.parent = target;
},
unlinked() {
this.parent = null;
}
current: 'checkbox',
},
classes: ['icon-class', 'label-class'],
props: {
@ -32,6 +27,9 @@ VantComponent({
value: 20
}
},
data: {
parentDisabled: false
},
methods: {
emitChange(value) {
if (this.parent) {
@ -42,14 +40,14 @@ VantComponent({
}
},
toggle() {
const { disabled, value } = this.data;
if (!disabled) {
const { parentDisabled, disabled, value } = this.data;
if (!disabled && !parentDisabled) {
this.emitChange(!value);
}
},
onClickLabel() {
const { labelDisabled, disabled, value } = this.data;
if (!disabled && !labelDisabled) {
const { labelDisabled, parentDisabled, disabled, value } = this.data;
if (!disabled && !labelDisabled && !parentDisabled) {
this.emitChange(!value);
}
},

View File

@ -1,4 +1,5 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<view class="van-checkbox custom-class">
<view class="van-checkbox__icon-wrap" bindtap="toggle">
@ -7,13 +8,13 @@
wx:else
name="success"
size="0.8em"
class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
style="font-size: {{ utils.addUnit(iconSize) }};{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}"
class="{{ utils.bem('checkbox__icon', [shape, { disabled: disabled || parentDisabled, checked: value }]) }}"
style="{{ computed.iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) }}"
custom-class="icon-class"
custom-style="line-height: 1.25em;"
/>
</view>
<view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled }]) }}" bindtap="onClickLabel">
<view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" bindtap="onClickLabel">
<slot />
</view>
</view>

20
dist/checkbox/index.wxs vendored Normal file
View File

@ -0,0 +1,20 @@
/* eslint-disable */
var utils = require('../wxs/utils.wxs');
function iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) {
var styles = [['font-size', utils.addUnit(iconSize)]];
if (checkedColor && value && !disabled && !parentDisabled) {
styles.push(['border-color', checkedColor]);
styles.push(['background-color', checkedColor]);
}
return styles
.map(function(item) {
return item.join(':');
})
.join(';');
}
module.exports = {
iconStyle: iconStyle
};

11
dist/col/index.js vendored
View File

@ -2,21 +2,22 @@ import { VantComponent } from '../common/component';
VantComponent({
relation: {
name: 'row',
type: 'ancestor'
type: 'ancestor',
current: 'col',
},
props: {
span: Number,
offset: Number
},
data: {
style: ''
viewStyle: ''
},
methods: {
setGutter(gutter) {
const padding = `${gutter / 2}px`;
const style = gutter ? `padding-left: ${padding}; padding-right: ${padding};` : '';
if (style !== this.data.style) {
this.setData({ style });
const viewStyle = gutter ? `padding-left: ${padding}; padding-right: ${padding};` : '';
if (viewStyle !== this.data.viewStyle) {
this.setData({ viewStyle });
}
}
}

2
dist/col/index.wxml vendored
View File

@ -2,7 +2,7 @@
<view
class="custom-class {{ utils.bem('col', [span]) }} {{ offset ? 'van-col--offset-' + offset : '' }}"
style="{{ style }}"
style="{{ viewStyle }}"
>
<slot />
</view>

View File

@ -5,9 +5,7 @@ VantComponent({
relation: {
name: 'collapse',
type: 'ancestor',
linked(parent) {
this.parent = parent;
}
current: 'collapse-item',
},
props: {
name: null,

View File

@ -3,12 +3,7 @@ VantComponent({
relation: {
name: 'collapse-item',
type: 'descendant',
linked(child) {
this.children.push(child);
},
unlinked(child) {
this.children = this.children.filter((item) => item !== child);
}
current: 'collapse',
},
props: {
value: {
@ -24,9 +19,6 @@ VantComponent({
value: true
}
},
beforeCreate() {
this.children = [];
},
methods: {
updateExpanded() {
this.children.forEach((child) => {

View File

@ -1,4 +1,23 @@
import { basic } from '../mixins/basic';
const relationFunctions = {
ancestor: {
linked(parent) {
this.parent = parent;
},
unlinked() {
this.parent = null;
},
},
descendant: {
linked(child) {
this.children = this.children || [];
this.children.push(child);
},
unlinked(child) {
this.children = (this.children || []).filter(it => it !== child);
},
},
};
function mapKeys(source, target, map) {
Object.keys(map).forEach(key => {
if (source[key]) {
@ -6,6 +25,36 @@ function mapKeys(source, target, map) {
}
});
}
function makeRelation(options, vantOptions, relation) {
const { type, name, linked, unlinked, linkChanged } = relation;
const { beforeCreate, destroyed } = vantOptions;
if (type === 'descendant') {
options.created = function () {
beforeCreate && beforeCreate.bind(this)();
this.children = this.children || [];
};
options.detached = function () {
this.children = [];
destroyed && destroyed.bind(this)();
};
}
options.relations = Object.assign(options.relations || {}, {
[`../${name}/index`]: {
type,
linked(node) {
relationFunctions[type].linked.bind(this)(node);
linked && linked.bind(this)(node);
},
linkChanged(node) {
linkChanged && linkChanged.bind(this)(node);
},
unlinked(node) {
relationFunctions[type].unlinked.bind(this)(node);
unlinked && unlinked.bind(this)(node);
},
}
});
}
function VantComponent(vantOptions = {}) {
const options = {};
mapKeys(vantOptions, options, {
@ -22,9 +71,7 @@ function VantComponent(vantOptions = {}) {
});
const { relation } = vantOptions;
if (relation) {
options.relations = Object.assign(options.relations || {}, {
[`../${relation.name}/index`]: relation
});
makeRelation(options, vantOptions, relation);
}
// add default externalClasses
options.externalClasses = options.externalClasses || [];

View File

@ -13,7 +13,9 @@ export interface VantComponentOptions<Data, Props, Methods, Instance> {
mixins?: string[];
props?: Props & Weapp.PropertyOption;
relation?: Weapp.RelationOption<Instance> & {
type: 'ancestor' | 'descendant';
name: string;
current: string;
};
relations?: {
[componentName: string]: Weapp.RelationOption<Instance>;

View File

@ -4,13 +4,10 @@ VantComponent({
relation: {
name: 'dropdown-menu',
type: 'ancestor',
linked(target) {
this.parent = target;
current: 'dropdown-item',
linked() {
this.updateDataFromParent();
},
unlinked() {
this.parent = null;
}
},
props: {
value: {
@ -65,6 +62,7 @@ VantComponent({
const { value } = option;
const shouldEmitChange = this.data.value !== value;
this.setData({ showPopup: false, value });
this.$emit('close');
setTimeout(() => {
this.setData({ showWrapper: false });
}, this.data.duration || 0);

View File

@ -6,12 +6,11 @@ VantComponent({
relation: {
name: 'dropdown-item',
type: 'descendant',
linked(target) {
this.children.push(target);
current: 'dropdown-menu',
linked() {
this.updateItemListData();
},
unlinked(target) {
this.children = this.children.filter((child) => child !== target);
unlinked() {
this.updateItemListData();
}
},
@ -55,7 +54,6 @@ VantComponent({
beforeCreate() {
const { windowHeight } = wx.getSystemInfoSync();
this.windowHeight = windowHeight;
this.children = [];
ARRAY.push(this);
},
destroyed() {

View File

@ -7,9 +7,7 @@ VantComponent({
relation: {
type: 'ancestor',
name: 'goods-action',
linked(parent) {
this.parent = parent;
}
current: 'goods-action-button',
},
props: {
text: String,
@ -34,13 +32,8 @@ VantComponent({
const { children = [] } = this.parent;
const { length } = children;
const index = children.indexOf(this);
let rightBorderLess = false;
if (length > 1) {
rightBorderLess = index !== length - 1;
}
this.setData({
isFirst: index === 0,
rightBorderLess,
isLast: index === length - 1
});
}

View File

@ -1,6 +1,5 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<van-button
square
id="{{ id }}"
lang="{{ lang }}"
type="{{ type }}"
@ -9,7 +8,8 @@
loading="{{ loading }}"
disabled="{{ disabled }}"
open-type="{{ openType }}"
custom-class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain : plain, ordinary: !plain }])}} {{ rightBorderLess ?'van-goods-action-button--no-right-border': ''}}"
class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])}}"
custom-class="van-goods-action-button__inner"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}"
@ -26,4 +26,5 @@
bindlaunchapp="bindLaunchApp"
>
{{ text }}
<slot></slot>
</van-button>

View File

@ -1 +1 @@
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{height:40px!important;height:var(--goods-action-button-height,40px)!important;font-weight:500!important;font-weight:var(--font-weight-bold,500)!important;line-height:40px!important;line-height:var(--goods-action-button-height,40px)!important}.van-goods-action-button--first{display:block!important;margin-left:5px;border-top-left-radius:20px!important;border-top-left-radius:var(--goods-action-button-border-radius,20px)!important;border-bottom-left-radius:20px!important;border-bottom-left-radius:var(--goods-action-button-border-radius,20px)!important}.van-goods-action-button--last{display:block!important;margin-right:5px;border-top-right-radius:20px!important;border-top-right-radius:var(--goods-action-button-border-radius,20px)!important;border-bottom-right-radius:20px!important;border-bottom-right-radius:var(--goods-action-button-border-radius,20px)!important}.van-goods-action-button--warning{background:linear-gradient(90deg,#ffd01e,#ff8917);background:var(--goods-action-button-warning-color,linear-gradient(90deg,#ffd01e,#ff8917))}.van-goods-action-button--danger{background:linear-gradient(90deg,#ff6034,#ee0a24);background:var(--goods-action-button-danger-color,linear-gradient(90deg,#ff6034,#ee0a24))}.van-goods-action-button--ordinary{border:none!important}.van-goods-action-button--plain{background:#fff;background:var(--goods-action-button-plain-color,#fff)}.van-goods-action-button--no-right-border{border-right-width:0!important}@media (max-width:321px){.van-goods-action-button{font-size:13px}}
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{--button-warning-background-color:linear-gradient(90deg,#ffd01e,#ff8917);--button-warning-background-color:var(--goods-action-button-warning-color,linear-gradient(90deg,#ffd01e,#ff8917));--button-danger-background-color:linear-gradient(90deg,#ff6034,#ee0a24);--button-danger-background-color:var(--goods-action-button-danger-color,linear-gradient(90deg,#ff6034,#ee0a24));--button-default-height:40px;--button-default-height:var(--goods-action-button-height,40px);--button-line-height:40px;--button-line-height:var(--goods-action-button-height,40px);--button-plain-background-color:#fff;--button-plain-background-color:var(--goods-action-button-plain-color,#fff);display:block;--button-border-width:0}.van-goods-action-button--first{margin-left:5px;--button-border-radius:20px 0 0 20px;--button-border-radius:var(--goods-action-button-border-radius,20px) 0 0 var(--goods-action-button-border-radius,20px)}.van-goods-action-button--last{margin-right:5px;--button-border-radius:0 20px 20px 0;--button-border-radius:0 var(--goods-action-button-border-radius,20px) var(--goods-action-button-border-radius,20px) 0}.van-goods-action-button--plain{--button-border-width:1px}.van-goods-action-button__inner{width:100%;font-weight:500!important;font-weight:var(--font-weight-bold,500)!important}@media (max-width:321px){.van-goods-action-button{font-size:13px}}

View File

@ -3,15 +3,7 @@ VantComponent({
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 = [];
current: 'goods-action',
},
props: {
safeAreaInsetBottom: {

View File

@ -5,9 +5,7 @@ VantComponent({
relation: {
name: 'grid',
type: 'ancestor',
linked(parent) {
this.parent = parent;
}
current: 'grid-item',
},
mixins: [link],
props: {
@ -17,6 +15,9 @@ VantComponent({
text: String,
useSlot: Boolean
},
data: {
viewStyle: '',
},
mounted() {
this.updateStyle();
},
@ -51,7 +52,7 @@ VantComponent({
`;
}
this.setData({
style: styleWrapper.join('; '),
viewStyle: styleWrapper.join('; '),
contentStyle,
center,
border,

View File

@ -1,6 +1,6 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="{{ utils.bem('grid-item', { square }) }}" style="{{ style }}" bindtap="onClick">
<view class="{{ utils.bem('grid-item', { square }) }}" style="{{ viewStyle }}" bindtap="onClick">
<view
class="{{ utils.bem('grid-item__content', { center, square, clickable, surround: border && gutter }) }} {{ border ? 'van-hairline--surround' : '' }}"
style="{{ contentStyle }}"

13
dist/grid/index.js vendored
View File

@ -4,12 +4,7 @@ VantComponent({
relation: {
name: 'grid-item',
type: 'descendant',
linked(child) {
this.children.push(child);
},
unlinked(child) {
this.children = this.children.filter((item) => item !== child);
}
current: 'grid',
},
props: {
square: {
@ -41,14 +36,14 @@ VantComponent({
observer: 'updateChildren'
}
},
beforeCreate() {
this.children = [];
data: {
viewStyle: '',
},
created() {
const { gutter } = this.data;
if (gutter) {
this.setData({
style: `padding-left: ${addUnit(gutter)}`
viewStyle: `padding-left: ${addUnit(gutter)}`
});
}
},

View File

@ -1,3 +1,3 @@
<view class="van-grid {{ border && !gutter ? 'van-hairline--top' : '' }}" style="{{ style }}">
<view class="van-grid {{ border && !gutter ? 'van-hairline--top' : '' }}" style="{{ viewStyle }}">
<slot />
</view>

5
dist/image/index.js vendored
View File

@ -51,7 +51,8 @@ VantComponent({
},
data: {
error: false,
loading: true
loading: true,
viewStyle: '',
},
mounted() {
this.setMode();
@ -76,7 +77,7 @@ VantComponent({
style += 'overflow: hidden;';
style += `border-radius: ${addUnit(radius)};`;
}
this.setData({ style });
this.setData({ viewStyle: style });
},
onLoad(event) {
this.setData({

View File

@ -1,7 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view
style="{{ style }}"
style="{{ viewStyle }}"
class="custom-class {{ utils.bem('image', { round })}}"
bind:tap="onClick"
>

View File

@ -3,12 +3,7 @@ VantComponent({
relation: {
name: 'index-bar',
type: 'ancestor',
linked(target) {
this.parent = target;
},
unlinked() {
this.parent = null;
}
current: 'index-anchor',
},
props: {
useSlot: Boolean,

View File

@ -12,6 +12,7 @@ VantComponent({
relation: {
name: 'index-anchor',
type: 'descendant',
current: 'index-bar',
linked() {
this.updateData();
},

View File

@ -9,5 +9,8 @@ VantComponent({
},
size: String,
textSize: String
}
},
data: {
array12: Array.from({ length: 12 }),
},
});

View File

@ -7,7 +7,7 @@
>
<view
wx:if="{{ type === 'spinner' }}"
wx:for="item in 12"
wx:for="{{ array12 }}"
wx:key="index"
class="van-loading__dot"
/>

View File

@ -25,6 +25,9 @@ VantComponent({
value: false
}
},
data: {
show: false,
},
created() {
const { statusBarHeight } = wx.getSystemInfoSync();
this.setData({ statusBarHeight });

View File

@ -4,14 +4,10 @@ VantComponent({
relation: {
name: 'radio',
type: 'descendant',
current: 'radio-group',
linked(target) {
this.children = this.children || [];
this.children.push(target);
this.updateChild(target);
},
unlinked(target) {
this.children = this.children.filter((child) => child !== target);
}
},
props: {
value: {

7
dist/radio/index.js vendored
View File

@ -4,12 +4,7 @@ VantComponent({
relation: {
name: 'radio-group',
type: 'ancestor',
linked(target) {
this.parent = target;
},
unlinked() {
this.parent = null;
}
current: 'radio',
},
classes: ['icon-class', 'label-class'],
props: {

8
dist/rate/index.js vendored
View File

@ -37,7 +37,10 @@ VantComponent({
},
count: {
type: Number,
value: 5
value: 5,
observer(value) {
this.setData({ innerCountArray: Array.from({ length: value }) });
},
},
gutter: null,
touchable: {
@ -46,7 +49,8 @@ VantComponent({
}
},
data: {
innerValue: 0
innerValue: 0,
innerCountArray: Array.from({ length: 5 }),
},
methods: {
onSelect(event) {

View File

@ -6,7 +6,7 @@
>
<view
class="van-rate__item"
wx:for="{{ count }}"
wx:for="{{ innerCountArray }}"
wx:key="index"
style="padding-right: {{ index !== count - 1 ? utils.addUnit(gutter) : '' }}"
>

8
dist/row/index.js vendored
View File

@ -3,6 +3,7 @@ VantComponent({
relation: {
name: 'col',
type: 'descendant',
current: 'row',
linked(target) {
if (this.data.gutter) {
target.setGutter(this.data.gutter);
@ -15,6 +16,9 @@ VantComponent({
observer: 'setGutter'
}
},
data: {
viewStyle: '',
},
mounted() {
if (this.data.gutter) {
this.setGutter();
@ -24,10 +28,10 @@ VantComponent({
setGutter() {
const { gutter } = this.data;
const margin = `-${Number(gutter) / 2}px`;
const style = gutter
const viewStyle = gutter
? `margin-right: ${margin}; margin-left: ${margin};`
: '';
this.setData({ style });
this.setData({ viewStyle });
this.getRelationNodes('../col/index').forEach(col => {
col.setGutter(this.data.gutter);
});

2
dist/row/index.wxml vendored
View File

@ -1,3 +1,3 @@
<view class="custom-class van-row" style="{{ style }}">
<view class="custom-class van-row" style="{{ viewStyle }}">
<slot />
</view>

View File

@ -7,9 +7,7 @@ VantComponent({
relation: {
type: 'ancestor',
name: 'sidebar',
linked(target) {
this.parent = target;
}
current: 'sidebar-item',
},
props: {
dot: Boolean,

View File

@ -3,12 +3,11 @@ VantComponent({
relation: {
name: 'sidebar-item',
type: 'descendant',
linked(target) {
this.children.push(target);
current: 'sidebar',
linked() {
this.setActive(this.data.activeKey);
},
unlinked(target) {
this.children = this.children.filter((item) => item !== target);
unlinked() {
this.setActive(this.data.activeKey);
}
},
@ -20,7 +19,6 @@ VantComponent({
}
},
beforeCreate() {
this.children = [];
this.currentActive = -1;
},
methods: {

View File

@ -4,7 +4,10 @@ VantComponent({
props: {
row: {
type: Number,
value: 0
value: 0,
observer(value) {
this.setData({ rowArray: Array.from({ length: value }) });
},
},
title: Boolean,
avatar: Boolean,
@ -37,6 +40,7 @@ VantComponent({
}
},
data: {
isArray: false
isArray: false,
rowArray: [],
}
});

View File

@ -16,7 +16,7 @@
style="{{ 'width:' + titleWidth }}"
/>
<view
wx:for="{{ row }}"
wx:for="{{ rowArray }}"
wx:key="index"
wx:for-index="index"
class="row-class {{ utils.bem('skeleton__row') }}"

View File

@ -42,9 +42,11 @@ VantComponent({
methods: {
updatePrice() {
const { price, decimalLength } = this.data;
const priceStrArr = typeof price === 'number' && (price / 100).toFixed(decimalLength).split('.');
this.setData({
hasPrice: typeof price === 'number',
priceStr: (price / 100).toFixed(decimalLength)
integerStr: priceStrArr && priceStrArr[0],
decimalStr: decimalLength && priceStrArr ? `.${priceStrArr[1]}` : ''
});
},
updateTip() {

View File

@ -22,18 +22,18 @@
<text>{{ label || '合计:' }}</text>
<text class="van-submit-bar__price price-class">
<text class="van-submit-bar__currency">{{ currency }} </text>
<text>{{ priceStr }}</text>
<text class="van-submit-bar__price-integer">{{ integerStr }}</text><text>{{decimalStr}}</text>
</text>
<text class="van-submit-bar__suffix-label">{{ suffixLabel }}</text>
</view>
<van-button
square
size="large"
round
type="{{ buttonType }}"
loading="{{ loading }}"
disabled="{{ disabled }}"
class="van-submit-bar__button"
custom-class="button-class"
custom-style="width: 100%;"
bind:click="onSubmit"
>
{{ loading ? '' : buttonText }}

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);background-color:#fff;background-color:var(--submit-bar-background-color,#fff)}.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;font-size:12px;font-size:var(--submit-bar-tip-icon-size,12px);min-width:18px;min-width:calc(var(--submit-bar-tip-icon-size, 12px)*1.5)}.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;text-align:right;color:#323233;color:var(--submit-bar-text-color,#323233);padding-right:12px;padding-right:var(--padding-sm,12px);font-weight:500;font-weight:var(--font-weight-bold,500)}.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);background-color:#fff;background-color:var(--submit-bar-background-color,#fff)}.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;font-size:12px;font-size:var(--submit-bar-tip-icon-size,12px);min-width:18px;min-width:calc(var(--submit-bar-tip-icon-size, 12px)*1.5)}.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;padding:0 16px;padding:var(--submit-bar-padding,0 16px);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;text-align:right;color:#323233;color:var(--submit-bar-text-color,#323233);padding-right:12px;padding-right:var(--padding-sm,12px)}.van-submit-bar__price,.van-submit-bar__text{font-weight:500;font-weight:var(--font-weight-bold,500)}.van-submit-bar__price{color:#ee0a24;color:var(--submit-bar-price-color,#ee0a24);font-size:12px;font-size:var(--submit-bar-price-font-size,12px)}.van-submit-bar__price-integer{font-size:20px;font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif}.van-submit-bar__currency{font-size:12px;font-size:var(--submit-bar-currency-font-size,12px)}.van-submit-bar__suffix-label{margin-left:5px}.van-submit-bar__button{width:110px;width:var(--submit-bar-button-width,110px);font-weight:500;font-weight:var(--font-weight-bold,500);--button-default-height:40px!important;--button-default-height:var(--submit-bar-button-height,40px)!important;--button-line-height:40px!important;--button-line-height:var(--submit-bar-button-height,40px)!important}

7
dist/tab/index.js vendored
View File

@ -3,12 +3,7 @@ VantComponent({
relation: {
name: 'tabs',
type: 'ancestor',
linked(target) {
this.parent = target;
},
unlinked() {
this.parent = null;
}
current: 'tab',
},
props: {
dot: {

View File

@ -8,7 +8,8 @@ VantComponent({
},
relation: {
name: 'tabbar',
type: 'ancestor'
type: 'ancestor',
current: 'tabbar-item',
},
data: {
active: false

View File

@ -3,13 +3,12 @@ VantComponent({
relation: {
name: 'tabbar-item',
type: 'descendant',
current: 'tabbar',
linked(target) {
this.children.push(target);
target.parent = this;
target.updateFromParent();
},
unlinked(target) {
this.children = this.children.filter((item) => item !== target);
unlinked() {
this.updateChildren();
}
},
@ -43,9 +42,6 @@ VantComponent({
value: true
}
},
beforeCreate() {
this.children = [];
},
methods: {
updateChildren() {
const { children } = this;

29
dist/tabs/index.js vendored
View File

@ -7,14 +7,13 @@ VantComponent({
relation: {
name: 'tab',
type: 'descendant',
current: 'tabs',
linked(target) {
target.index = this.children.length;
this.children.push(target);
target.index = this.children.length - 1;
this.updateTabs();
},
unlinked(target) {
unlinked() {
this.children = this.children
.filter((child) => child !== target)
.map((child, index) => {
child.index = index;
return child;
@ -103,15 +102,13 @@ VantComponent({
currentIndex: null,
container: null
},
beforeCreate() {
this.children = [];
},
mounted() {
this.setData({
container: () => this.createSelectorQuery().select('.van-tabs')
}, () => {
this.setLine(true);
this.scrollIntoView();
});
this.setLine(true);
this.scrollIntoView();
},
methods: {
updateTabs() {
@ -122,23 +119,23 @@ VantComponent({
});
this.setCurrentIndexByName(this.getCurrentName() || data.active);
},
trigger(eventName) {
trigger(eventName, child) {
const { currentIndex } = this.data;
const child = this.children[currentIndex];
if (!isDef(child)) {
const currentChild = child || this.children[currentIndex];
if (!isDef(currentChild)) {
return;
}
this.$emit(eventName, {
index: currentIndex,
name: child.getComputedName(),
title: child.data.title
index: currentChild.index,
name: currentChild.getComputedName(),
title: currentChild.data.title
});
},
onTap(event) {
const { index } = event.currentTarget.dataset;
const child = this.children[index];
if (child.data.disabled) {
this.trigger('disabled');
this.trigger('disabled', child);
}
else {
this.setCurrentIndex(index);

View File

@ -7,7 +7,7 @@ component_1.VantComponent({
mixins: [button_1.button, open_type_1.openType],
classes: ['hover-class', 'loading-class'],
data: {
style: ''
baseStyle: ''
},
props: {
icon: String,
@ -54,8 +54,8 @@ component_1.VantComponent({
style += "border-color: " + color + ";";
}
}
if (style !== this.data.style) {
this.setData({ style: style });
if (style !== this.data.baseStyle) {
this.setData({ baseStyle: style });
}
}
}

View File

@ -5,7 +5,7 @@
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
hover-class="van-button--active hover-class"
lang="{{ lang }}"
style="{{ style }} {{ customStyle }}"
style="{{ baseStyle }} {{ customStyle }}"
open-type="{{ openType }}"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
@ -28,7 +28,7 @@
custom-class="loading-class"
size="{{ loadingSize }}"
type="{{ loadingType }}"
color="{{ type === 'default' ? '#c9c9c9' : 'white' }}"
color="{{ loadingColor(type,color,plain) }}"
/>
<view
wx:if="{{ loadingText }}"
@ -50,3 +50,19 @@
</view>
</block>
</button>
<wxs module="loadingColor">
function get(type, color,plain) {
if(plain) {
return color ? color: '#c9c9c9';
}
if(type === 'default') {
return '#c9c9c9';
}
return 'white';
}
module.exports = get;
</wxs>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-button{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:0;line-height:20px;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%;height:44px;height:var(--button-default-height,44px);font-size:16px;font-size:var(--button-default-font-size,16px);transition:opacity .2s;transition:opacity var(--animation-duration-fast,.2s);border-radius:2px;border-radius:var(--button-border-radius,2px)}.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:#323233;color:var(--button-default-color,#323233);background-color:#fff;background-color:var(--button-default-background-color,#fff);border:1px solid #ebedf0;border:1px solid var(--button-default-border-color,#ebedf0)}.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(--button-plain-background-color,#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;height:var(--button-large-height,50px)}.van-button--normal{padding:0 15px;font-size:14px;font-size:var(--button-normal-font-size,14px)}.van-button--small{min-width:60px;min-width:var(--button-small-min-width,60px);height:30px;height:var(--button-small-height,30px);padding:0 8px;padding:0 var(--padding-xs,8px);font-size:12px;font-size:var(--button-small-font-size,12px)}.van-button--mini{display:inline-block;min-width:50px;min-width:var(--button-mini-min-width,50px);height:22px;height:var(--button-mini-height,22px);font-size:10px;font-size:var(--button-mini-font-size,10px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:-webkit-flex;display:flex;width:100%}.van-button--round{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5;opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{min-width:1em;line-height:inherit!important;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:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0}
@import '../common/index.wxss';.van-button{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;padding:0;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%;height:44px;height:var(--button-default-height,44px);line-height:20px;line-height:var(--button-line-height,20px);font-size:16px;font-size:var(--button-default-font-size,16px);transition:opacity .2s;transition:opacity var(--animation-duration-fast,.2s);border-radius:2px;border-radius:var(--button-border-radius,2px)}.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:#323233;color:var(--button-default-color,#323233);background:#fff;background:var(--button-default-background-color,#fff);border:1px solid #ebedf0;border:var(--button-border-width,1px) solid var(--button-default-border-color,#ebedf0)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background:#07c160;background:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:var(--button-border-width,1px) solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background:#1989fa;background:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:var(--button-border-width,1px) solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background:#ee0a24;background:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:var(--button-border-width,1px) solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background:#ff976a;background:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:var(--button-border-width,1px) solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background:#fff;background:var(--button-plain-background-color,#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;height:var(--button-large-height,50px)}.van-button--normal{padding:0 15px;font-size:14px;font-size:var(--button-normal-font-size,14px)}.van-button--small{min-width:60px;min-width:var(--button-small-min-width,60px);height:30px;height:var(--button-small-height,30px);padding:0 8px;padding:0 var(--padding-xs,8px);font-size:12px;font-size:var(--button-small-font-size,12px)}.van-button--mini{display:inline-block;min-width:50px;min-width:var(--button-mini-min-width,50px);height:22px;height:var(--button-mini-height,22px);font-size:10px;font-size:var(--button-mini-font-size,10px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:-webkit-flex;display:flex;width:100%}.van-button--round{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5;opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{min-width:1em;line-height:inherit!important;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:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0}

View File

@ -18,7 +18,10 @@ component_1.VantComponent({
desc: String,
thumb: String,
title: String,
price: String,
price: {
type: String,
observer: 'updatePrice'
},
centered: Boolean,
lazyLoad: Boolean,
thumbLink: String,
@ -33,6 +36,14 @@ component_1.VantComponent({
}
},
methods: {
updatePrice: function () {
var price = this.data.price;
var priceArr = price.toString().split('.');
this.setData({
integerStr: priceArr[0],
decimalStr: priceArr[1] ? "." + priceArr[1] : '',
});
},
onClickThumb: function () {
this.jumpLink('thumbLink');
}

View File

@ -21,17 +21,20 @@
</van-tag>
</view>
<view class="van-card__content">
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
<slot wx:else name="title" />
<view class="van-card__content {{ utils.bem('card__content', { center: centered }) }}">
<view>
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
<slot wx:else name="title" />
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
<slot wx:else name="desc" />
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
<slot wx:else name="desc" />
<slot name="tags" />
<slot name="tags" />
</view>
<view class="van-card__bottom">
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
<slot name="price-top" />
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }}<text class="van-card__price-integer">{{ integerStr }}</text><text class="van-card__price-decimal">{{ decimalStr }}</text></view>
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
<slot name="bottom" />

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-card{position:relative;box-sizing:border-box;padding:8px 16px;padding:var(--card-padding,8px 16px);font-size:12px;font-size:var(--card-font-size,12px);color:#323233;color:var(--card-text-color,#323233);background-color:#fafafa;background-color:var(--card-background-color,#fafafa)}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;-webkit-flex:none;flex:none;width:90px;width:var(--card-thumb-size,90px);height:90px;height:var(--card-thumb-size,90px);margin-right:8px;margin-right:var(--padding-xs,8px)}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%}.van-card__content{position:relative;-webkit-flex:1;flex:1;min-width:0}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:16px;line-height:var(--card-title-line-height,16px)}.van-card__desc{line-height:20px;line-height:var(--card-desc-line-height,20px);color:#646566;color:var(--card-desc-color,#646566)}.van-card__bottom{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#ee0a24;color:var(--card-price-color,#ee0a24)}.van-card__origin-price{display:inline-block;margin-left:5px;text-decoration:line-through;font-size:10px;font-size:var(--card-origin-price-font-size,10px);color:#646566;color:var(--card-origin-price-color,#646566)}.van-card__num{float:right}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{-webkit-flex:none;flex:none;width:100%;text-align:right}
@import '../common/index.wxss';.van-card{position:relative;box-sizing:border-box;padding:8px 16px;padding:var(--card-padding,8px 16px);font-size:12px;font-size:var(--card-font-size,12px);color:#323233;color:var(--card-text-color,#323233);background-color:#fafafa;background-color:var(--card-background-color,#fafafa)}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;-webkit-flex:none;flex:none;width:88px;width:var(--card-thumb-size,88px);height:88px;height:var(--card-thumb-size,88px);margin-right:8px;margin-right:var(--padding-xs,8px)}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%;border-radius:8px;border-radius:var(--border-radius-lg,8px)}.van-card__content{position:relative;display:-webkit-flex;display:flex;-webkit-flex:1;flex:1;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:space-between;justify-content:space-between;min-width:0;min-height:88px;min-height:var(--card-thumb-size,88px)}.van-card__content--center{-webkit-justify-content:center;justify-content:center}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:16px;line-height:var(--card-title-line-height,16px)}.van-card__desc{line-height:20px;line-height:var(--card-desc-line-height,20px);color:#646566;color:var(--card-desc-color,#646566)}.van-card__bottom{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#ee0a24;color:var(--card-price-color,#ee0a24);font-size:12px;font-size:var(--card-price-font-size,12px)}.van-card__price-integer{font-size:16px;font-size:var(--card-price-integer-font-size,16px)}.van-card__price-decimal,.van-card__price-integer{font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif;font-family:var(--card-price-font-family,Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif)}.van-card__origin-price{display:inline-block;margin-left:5px;text-decoration:line-through;font-size:10px;font-size:var(--card-origin-price-font-size,10px);color:#646566;color:var(--card-origin-price-color,#646566)}.van-card__num{float:right}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{-webkit-flex:none;flex:none;width:100%;text-align:right}

View File

@ -6,14 +6,10 @@ component_1.VantComponent({
relation: {
name: 'checkbox',
type: 'descendant',
current: 'checkbox-group',
linked: function (target) {
this.children = this.children || [];
this.children.push(target);
this.updateChild(target);
},
unlinked: function (target) {
this.children = this.children.filter(function (child) { return child !== target; });
}
},
props: {
max: Number,
@ -37,7 +33,7 @@ component_1.VantComponent({
var _a = this.data, value = _a.value, disabled = _a.disabled;
child.setData({
value: value.indexOf(child.data.name) !== -1,
disabled: disabled || child.data.disabled
parentDisabled: disabled
});
}
}

View File

@ -10,12 +10,7 @@ component_1.VantComponent({
relation: {
name: 'checkbox-group',
type: 'ancestor',
linked: function (target) {
this.parent = target;
},
unlinked: function () {
this.parent = null;
}
current: 'checkbox',
},
classes: ['icon-class', 'label-class'],
props: {
@ -34,6 +29,9 @@ component_1.VantComponent({
value: 20
}
},
data: {
parentDisabled: false
},
methods: {
emitChange: function (value) {
if (this.parent) {
@ -44,14 +42,14 @@ component_1.VantComponent({
}
},
toggle: function () {
var _a = this.data, disabled = _a.disabled, value = _a.value;
if (!disabled) {
var _a = this.data, parentDisabled = _a.parentDisabled, disabled = _a.disabled, value = _a.value;
if (!disabled && !parentDisabled) {
this.emitChange(!value);
}
},
onClickLabel: function () {
var _a = this.data, labelDisabled = _a.labelDisabled, disabled = _a.disabled, value = _a.value;
if (!disabled && !labelDisabled) {
var _a = this.data, labelDisabled = _a.labelDisabled, parentDisabled = _a.parentDisabled, disabled = _a.disabled, value = _a.value;
if (!disabled && !labelDisabled && !parentDisabled) {
this.emitChange(!value);
}
},

View File

@ -1,4 +1,5 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<view class="van-checkbox custom-class">
<view class="van-checkbox__icon-wrap" bindtap="toggle">
@ -7,13 +8,13 @@
wx:else
name="success"
size="0.8em"
class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
style="font-size: {{ utils.addUnit(iconSize) }};{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}"
class="{{ utils.bem('checkbox__icon', [shape, { disabled: disabled || parentDisabled, checked: value }]) }}"
style="{{ computed.iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) }}"
custom-class="icon-class"
custom-style="line-height: 1.25em;"
/>
</view>
<view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled }]) }}" bindtap="onClickLabel">
<view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled: disabled || parentDisabled }]) }}" bindtap="onClickLabel">
<slot />
</view>
</view>

20
lib/checkbox/index.wxs Normal file
View File

@ -0,0 +1,20 @@
/* eslint-disable */
var utils = require('../wxs/utils.wxs');
function iconStyle(checkedColor, value, disabled, parentDisabled, iconSize) {
var styles = [['font-size', utils.addUnit(iconSize)]];
if (checkedColor && value && !disabled && !parentDisabled) {
styles.push(['border-color', checkedColor]);
styles.push(['background-color', checkedColor]);
}
return styles
.map(function(item) {
return item.join(':');
})
.join(';');
}
module.exports = {
iconStyle: iconStyle
};

View File

@ -4,21 +4,22 @@ var component_1 = require("../common/component");
component_1.VantComponent({
relation: {
name: 'row',
type: 'ancestor'
type: 'ancestor',
current: 'col',
},
props: {
span: Number,
offset: Number
},
data: {
style: ''
viewStyle: ''
},
methods: {
setGutter: function (gutter) {
var padding = gutter / 2 + "px";
var style = gutter ? "padding-left: " + padding + "; padding-right: " + padding + ";" : '';
if (style !== this.data.style) {
this.setData({ style: style });
var viewStyle = gutter ? "padding-left: " + padding + "; padding-right: " + padding + ";" : '';
if (viewStyle !== this.data.viewStyle) {
this.setData({ viewStyle: viewStyle });
}
}
}

View File

@ -2,7 +2,7 @@
<view
class="custom-class {{ utils.bem('col', [span]) }} {{ offset ? 'van-col--offset-' + offset : '' }}"
style="{{ style }}"
style="{{ viewStyle }}"
>
<slot />
</view>

View File

@ -7,9 +7,7 @@ component_1.VantComponent({
relation: {
name: 'collapse',
type: 'ancestor',
linked: function (parent) {
this.parent = parent;
}
current: 'collapse-item',
},
props: {
name: null,

View File

@ -5,12 +5,7 @@ component_1.VantComponent({
relation: {
name: 'collapse-item',
type: 'descendant',
linked: function (child) {
this.children.push(child);
},
unlinked: function (child) {
this.children = this.children.filter(function (item) { return item !== child; });
}
current: 'collapse',
},
props: {
value: {
@ -26,9 +21,6 @@ component_1.VantComponent({
value: true
}
},
beforeCreate: function () {
this.children = [];
},
methods: {
updateExpanded: function () {
this.children.forEach(function (child) {

View File

@ -1,6 +1,25 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var basic_1 = require("../mixins/basic");
var relationFunctions = {
ancestor: {
linked: function (parent) {
this.parent = parent;
},
unlinked: function () {
this.parent = null;
},
},
descendant: {
linked: function (child) {
this.children = this.children || [];
this.children.push(child);
},
unlinked: function (child) {
this.children = (this.children || []).filter(function (it) { return it !== child; });
},
},
};
function mapKeys(source, target, map) {
Object.keys(map).forEach(function (key) {
if (source[key]) {
@ -8,8 +27,38 @@ function mapKeys(source, target, map) {
}
});
}
function VantComponent(vantOptions) {
function makeRelation(options, vantOptions, relation) {
var _a;
var type = relation.type, name = relation.name, linked = relation.linked, unlinked = relation.unlinked, linkChanged = relation.linkChanged;
var beforeCreate = vantOptions.beforeCreate, destroyed = vantOptions.destroyed;
if (type === 'descendant') {
options.created = function () {
beforeCreate && beforeCreate.bind(this)();
this.children = this.children || [];
};
options.detached = function () {
this.children = [];
destroyed && destroyed.bind(this)();
};
}
options.relations = Object.assign(options.relations || {}, (_a = {},
_a["../" + name + "/index"] = {
type: type,
linked: function (node) {
relationFunctions[type].linked.bind(this)(node);
linked && linked.bind(this)(node);
},
linkChanged: function (node) {
linkChanged && linkChanged.bind(this)(node);
},
unlinked: function (node) {
relationFunctions[type].unlinked.bind(this)(node);
unlinked && unlinked.bind(this)(node);
},
},
_a));
}
function VantComponent(vantOptions) {
if (vantOptions === void 0) { vantOptions = {}; }
var options = {};
mapKeys(vantOptions, options, {
@ -26,9 +75,7 @@ function VantComponent(vantOptions) {
});
var relation = vantOptions.relation;
if (relation) {
options.relations = Object.assign(options.relations || {}, (_a = {},
_a["../" + relation.name + "/index"] = relation,
_a));
makeRelation(options, vantOptions, relation);
}
// add default externalClasses
options.externalClasses = options.externalClasses || [];

View File

@ -6,13 +6,10 @@ component_1.VantComponent({
relation: {
name: 'dropdown-menu',
type: 'ancestor',
linked: function (target) {
this.parent = target;
current: 'dropdown-item',
linked: function () {
this.updateDataFromParent();
},
unlinked: function () {
this.parent = null;
}
},
props: {
value: {
@ -69,6 +66,7 @@ component_1.VantComponent({
var value = option.value;
var shouldEmitChange = this.data.value !== value;
this.setData({ showPopup: false, value: value });
this.$emit('close');
setTimeout(function () {
_this.setData({ showWrapper: false });
}, this.data.duration || 0);

View File

@ -8,12 +8,11 @@ component_1.VantComponent({
relation: {
name: 'dropdown-item',
type: 'descendant',
linked: function (target) {
this.children.push(target);
current: 'dropdown-menu',
linked: function () {
this.updateItemListData();
},
unlinked: function (target) {
this.children = this.children.filter(function (child) { return child !== target; });
unlinked: function () {
this.updateItemListData();
}
},
@ -57,7 +56,6 @@ component_1.VantComponent({
beforeCreate: function () {
var windowHeight = wx.getSystemInfoSync().windowHeight;
this.windowHeight = windowHeight;
this.children = [];
ARRAY.push(this);
},
destroyed: function () {

View File

@ -9,9 +9,7 @@ component_1.VantComponent({
relation: {
type: 'ancestor',
name: 'goods-action',
linked: function (parent) {
this.parent = parent;
}
current: 'goods-action-button',
},
props: {
text: String,
@ -36,13 +34,8 @@ component_1.VantComponent({
var _a = this.parent.children, children = _a === void 0 ? [] : _a;
var length = children.length;
var index = children.indexOf(this);
var rightBorderLess = false;
if (length > 1) {
rightBorderLess = index !== length - 1;
}
this.setData({
isFirst: index === 0,
rightBorderLess: rightBorderLess,
isLast: index === length - 1
});
}

View File

@ -1,6 +1,5 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<van-button
square
id="{{ id }}"
lang="{{ lang }}"
type="{{ type }}"
@ -9,7 +8,8 @@
loading="{{ loading }}"
disabled="{{ disabled }}"
open-type="{{ openType }}"
custom-class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain : plain, ordinary: !plain }])}} {{ rightBorderLess ?'van-goods-action-button--no-right-border': ''}}"
class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain: plain }])}}"
custom-class="van-goods-action-button__inner"
business-id="{{ businessId }}"
session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}"
@ -26,4 +26,5 @@
bindlaunchapp="bindLaunchApp"
>
{{ text }}
<slot></slot>
</van-button>

View File

@ -1 +1 @@
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{height:40px!important;height:var(--goods-action-button-height,40px)!important;font-weight:500!important;font-weight:var(--font-weight-bold,500)!important;line-height:40px!important;line-height:var(--goods-action-button-height,40px)!important}.van-goods-action-button--first{display:block!important;margin-left:5px;border-top-left-radius:20px!important;border-top-left-radius:var(--goods-action-button-border-radius,20px)!important;border-bottom-left-radius:20px!important;border-bottom-left-radius:var(--goods-action-button-border-radius,20px)!important}.van-goods-action-button--last{display:block!important;margin-right:5px;border-top-right-radius:20px!important;border-top-right-radius:var(--goods-action-button-border-radius,20px)!important;border-bottom-right-radius:20px!important;border-bottom-right-radius:var(--goods-action-button-border-radius,20px)!important}.van-goods-action-button--warning{background:linear-gradient(90deg,#ffd01e,#ff8917);background:var(--goods-action-button-warning-color,linear-gradient(90deg,#ffd01e,#ff8917))}.van-goods-action-button--danger{background:linear-gradient(90deg,#ff6034,#ee0a24);background:var(--goods-action-button-danger-color,linear-gradient(90deg,#ff6034,#ee0a24))}.van-goods-action-button--ordinary{border:none!important}.van-goods-action-button--plain{background:#fff;background:var(--goods-action-button-plain-color,#fff)}.van-goods-action-button--no-right-border{border-right-width:0!important}@media (max-width:321px){.van-goods-action-button{font-size:13px}}
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{--button-warning-background-color:linear-gradient(90deg,#ffd01e,#ff8917);--button-warning-background-color:var(--goods-action-button-warning-color,linear-gradient(90deg,#ffd01e,#ff8917));--button-danger-background-color:linear-gradient(90deg,#ff6034,#ee0a24);--button-danger-background-color:var(--goods-action-button-danger-color,linear-gradient(90deg,#ff6034,#ee0a24));--button-default-height:40px;--button-default-height:var(--goods-action-button-height,40px);--button-line-height:40px;--button-line-height:var(--goods-action-button-height,40px);--button-plain-background-color:#fff;--button-plain-background-color:var(--goods-action-button-plain-color,#fff);display:block;--button-border-width:0}.van-goods-action-button--first{margin-left:5px;--button-border-radius:20px 0 0 20px;--button-border-radius:var(--goods-action-button-border-radius,20px) 0 0 var(--goods-action-button-border-radius,20px)}.van-goods-action-button--last{margin-right:5px;--button-border-radius:0 20px 20px 0;--button-border-radius:0 var(--goods-action-button-border-radius,20px) var(--goods-action-button-border-radius,20px) 0}.van-goods-action-button--plain{--button-border-width:1px}.van-goods-action-button__inner{width:100%;font-weight:500!important;font-weight:var(--font-weight-bold,500)!important}@media (max-width:321px){.van-goods-action-button{font-size:13px}}

View File

@ -5,15 +5,7 @@ component_1.VantComponent({
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 = [];
current: 'goods-action',
},
props: {
safeAreaInsetBottom: {

View File

@ -7,9 +7,7 @@ component_1.VantComponent({
relation: {
name: 'grid',
type: 'ancestor',
linked: function (parent) {
this.parent = parent;
}
current: 'grid-item',
},
mixins: [link_1.link],
props: {
@ -19,6 +17,9 @@ component_1.VantComponent({
text: String,
useSlot: Boolean
},
data: {
viewStyle: '',
},
mounted: function () {
this.updateStyle();
},
@ -49,7 +50,7 @@ component_1.VantComponent({
contentStyle = "\n right: " + gutterValue + ";\n bottom: " + gutterValue + ";\n height: auto;\n ";
}
this.setData({
style: styleWrapper.join('; '),
viewStyle: styleWrapper.join('; '),
contentStyle: contentStyle,
center: center,
border: border,

View File

@ -1,6 +1,6 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="{{ utils.bem('grid-item', { square }) }}" style="{{ style }}" bindtap="onClick">
<view class="{{ utils.bem('grid-item', { square }) }}" style="{{ viewStyle }}" bindtap="onClick">
<view
class="{{ utils.bem('grid-item__content', { center, square, clickable, surround: border && gutter }) }} {{ border ? 'van-hairline--surround' : '' }}"
style="{{ contentStyle }}"

View File

@ -6,12 +6,7 @@ component_1.VantComponent({
relation: {
name: 'grid-item',
type: 'descendant',
linked: function (child) {
this.children.push(child);
},
unlinked: function (child) {
this.children = this.children.filter(function (item) { return item !== child; });
}
current: 'grid',
},
props: {
square: {
@ -43,14 +38,14 @@ component_1.VantComponent({
observer: 'updateChildren'
}
},
beforeCreate: function () {
this.children = [];
data: {
viewStyle: '',
},
created: function () {
var gutter = this.data.gutter;
if (gutter) {
this.setData({
style: "padding-left: " + utils_1.addUnit(gutter)
viewStyle: "padding-left: " + utils_1.addUnit(gutter)
});
}
},

View File

@ -1,3 +1,3 @@
<view class="van-grid {{ border && !gutter ? 'van-hairline--top' : '' }}" style="{{ style }}">
<view class="van-grid {{ border && !gutter ? 'van-hairline--top' : '' }}" style="{{ viewStyle }}">
<slot />
</view>

View File

@ -53,7 +53,8 @@ component_1.VantComponent({
},
data: {
error: false,
loading: true
loading: true,
viewStyle: '',
},
mounted: function () {
this.setMode();
@ -78,7 +79,7 @@ component_1.VantComponent({
style += 'overflow: hidden;';
style += "border-radius: " + utils_1.addUnit(radius) + ";";
}
this.setData({ style: style });
this.setData({ viewStyle: style });
},
onLoad: function (event) {
this.setData({

View File

@ -1,7 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view
style="{{ style }}"
style="{{ viewStyle }}"
class="custom-class {{ utils.bem('image', { round })}}"
bind:tap="onClick"
>

View File

@ -5,12 +5,7 @@ component_1.VantComponent({
relation: {
name: 'index-bar',
type: 'ancestor',
linked: function (target) {
this.parent = target;
},
unlinked: function () {
this.parent = null;
}
current: 'index-anchor',
},
props: {
useSlot: Boolean,

View File

@ -14,6 +14,7 @@ component_1.VantComponent({
relation: {
name: 'index-anchor',
type: 'descendant',
current: 'index-bar',
linked: function () {
this.updateData();
},

View File

@ -11,5 +11,8 @@ component_1.VantComponent({
},
size: String,
textSize: String
}
},
data: {
array12: Array.from({ length: 12 }),
},
});

View File

@ -7,7 +7,7 @@
>
<view
wx:if="{{ type === 'spinner' }}"
wx:for="item in 12"
wx:for="{{ array12 }}"
wx:key="index"
class="van-loading__dot"
/>

View File

@ -27,6 +27,9 @@ component_1.VantComponent({
value: false
}
},
data: {
show: false,
},
created: function () {
var statusBarHeight = wx.getSystemInfoSync().statusBarHeight;
this.setData({ statusBarHeight: statusBarHeight });

View File

@ -6,14 +6,10 @@ component_1.VantComponent({
relation: {
name: 'radio',
type: 'descendant',
current: 'radio-group',
linked: function (target) {
this.children = this.children || [];
this.children.push(target);
this.updateChild(target);
},
unlinked: function (target) {
this.children = this.children.filter(function (child) { return child !== target; });
}
},
props: {
value: {

View File

@ -6,12 +6,7 @@ component_1.VantComponent({
relation: {
name: 'radio-group',
type: 'ancestor',
linked: function (target) {
this.parent = target;
},
unlinked: function () {
this.parent = null;
}
current: 'radio',
},
classes: ['icon-class', 'label-class'],
props: {

View File

@ -50,7 +50,10 @@ component_1.VantComponent({
},
count: {
type: Number,
value: 5
value: 5,
observer: function (value) {
this.setData({ innerCountArray: Array.from({ length: value }) });
},
},
gutter: null,
touchable: {
@ -59,7 +62,8 @@ component_1.VantComponent({
}
},
data: {
innerValue: 0
innerValue: 0,
innerCountArray: Array.from({ length: 5 }),
},
methods: {
onSelect: function (event) {

View File

@ -6,7 +6,7 @@
>
<view
class="van-rate__item"
wx:for="{{ count }}"
wx:for="{{ innerCountArray }}"
wx:key="index"
style="padding-right: {{ index !== count - 1 ? utils.addUnit(gutter) : '' }}"
>

View File

@ -5,6 +5,7 @@ component_1.VantComponent({
relation: {
name: 'col',
type: 'descendant',
current: 'row',
linked: function (target) {
if (this.data.gutter) {
target.setGutter(this.data.gutter);
@ -17,6 +18,9 @@ component_1.VantComponent({
observer: 'setGutter'
}
},
data: {
viewStyle: '',
},
mounted: function () {
if (this.data.gutter) {
this.setGutter();
@ -27,10 +31,10 @@ component_1.VantComponent({
var _this = this;
var gutter = this.data.gutter;
var margin = "-" + Number(gutter) / 2 + "px";
var style = gutter
var viewStyle = gutter
? "margin-right: " + margin + "; margin-left: " + margin + ";"
: '';
this.setData({ style: style });
this.setData({ viewStyle: viewStyle });
this.getRelationNodes('../col/index').forEach(function (col) {
col.setGutter(_this.data.gutter);
});

View File

@ -1,3 +1,3 @@
<view class="custom-class van-row" style="{{ style }}">
<view class="custom-class van-row" style="{{ viewStyle }}">
<slot />
</view>

View File

@ -9,9 +9,7 @@ component_1.VantComponent({
relation: {
type: 'ancestor',
name: 'sidebar',
linked: function (target) {
this.parent = target;
}
current: 'sidebar-item',
},
props: {
dot: Boolean,

View File

@ -5,12 +5,11 @@ component_1.VantComponent({
relation: {
name: 'sidebar-item',
type: 'descendant',
linked: function (target) {
this.children.push(target);
current: 'sidebar',
linked: function () {
this.setActive(this.data.activeKey);
},
unlinked: function (target) {
this.children = this.children.filter(function (item) { return item !== target; });
unlinked: function () {
this.setActive(this.data.activeKey);
}
},
@ -22,7 +21,6 @@ component_1.VantComponent({
}
},
beforeCreate: function () {
this.children = [];
this.currentActive = -1;
},
methods: {

View File

@ -6,7 +6,10 @@ component_1.VantComponent({
props: {
row: {
type: Number,
value: 0
value: 0,
observer: function (value) {
this.setData({ rowArray: Array.from({ length: value }) });
},
},
title: Boolean,
avatar: Boolean,
@ -39,6 +42,7 @@ component_1.VantComponent({
}
},
data: {
isArray: false
isArray: false,
rowArray: [],
}
});

View File

@ -16,7 +16,7 @@
style="{{ 'width:' + titleWidth }}"
/>
<view
wx:for="{{ row }}"
wx:for="{{ rowArray }}"
wx:key="index"
wx:for-index="index"
class="row-class {{ utils.bem('skeleton__row') }}"

View File

@ -44,9 +44,11 @@ component_1.VantComponent({
methods: {
updatePrice: function () {
var _a = this.data, price = _a.price, decimalLength = _a.decimalLength;
var priceStrArr = typeof price === 'number' && (price / 100).toFixed(decimalLength).split('.');
this.setData({
hasPrice: typeof price === 'number',
priceStr: (price / 100).toFixed(decimalLength)
integerStr: priceStrArr && priceStrArr[0],
decimalStr: decimalLength && priceStrArr ? "." + priceStrArr[1] : ''
});
},
updateTip: function () {

View File

@ -22,18 +22,18 @@
<text>{{ label || '合计:' }}</text>
<text class="van-submit-bar__price price-class">
<text class="van-submit-bar__currency">{{ currency }} </text>
<text>{{ priceStr }}</text>
<text class="van-submit-bar__price-integer">{{ integerStr }}</text><text>{{decimalStr}}</text>
</text>
<text class="van-submit-bar__suffix-label">{{ suffixLabel }}</text>
</view>
<van-button
square
size="large"
round
type="{{ buttonType }}"
loading="{{ loading }}"
disabled="{{ disabled }}"
class="van-submit-bar__button"
custom-class="button-class"
custom-style="width: 100%;"
bind:click="onSubmit"
>
{{ loading ? '' : buttonText }}

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);background-color:#fff;background-color:var(--submit-bar-background-color,#fff)}.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;font-size:12px;font-size:var(--submit-bar-tip-icon-size,12px);min-width:18px;min-width:calc(var(--submit-bar-tip-icon-size, 12px)*1.5)}.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;text-align:right;color:#323233;color:var(--submit-bar-text-color,#323233);padding-right:12px;padding-right:var(--padding-sm,12px);font-weight:500;font-weight:var(--font-weight-bold,500)}.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);background-color:#fff;background-color:var(--submit-bar-background-color,#fff)}.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;font-size:12px;font-size:var(--submit-bar-tip-icon-size,12px);min-width:18px;min-width:calc(var(--submit-bar-tip-icon-size, 12px)*1.5)}.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;padding:0 16px;padding:var(--submit-bar-padding,0 16px);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;text-align:right;color:#323233;color:var(--submit-bar-text-color,#323233);padding-right:12px;padding-right:var(--padding-sm,12px)}.van-submit-bar__price,.van-submit-bar__text{font-weight:500;font-weight:var(--font-weight-bold,500)}.van-submit-bar__price{color:#ee0a24;color:var(--submit-bar-price-color,#ee0a24);font-size:12px;font-size:var(--submit-bar-price-font-size,12px)}.van-submit-bar__price-integer{font-size:20px;font-family:Avenir-Heavy,PingFang SC,Helvetica Neue,Arial,sans-serif}.van-submit-bar__currency{font-size:12px;font-size:var(--submit-bar-currency-font-size,12px)}.van-submit-bar__suffix-label{margin-left:5px}.van-submit-bar__button{width:110px;width:var(--submit-bar-button-width,110px);font-weight:500;font-weight:var(--font-weight-bold,500);--button-default-height:40px!important;--button-default-height:var(--submit-bar-button-height,40px)!important;--button-line-height:40px!important;--button-line-height:var(--submit-bar-button-height,40px)!important}

View File

@ -5,12 +5,7 @@ component_1.VantComponent({
relation: {
name: 'tabs',
type: 'ancestor',
linked: function (target) {
this.parent = target;
},
unlinked: function () {
this.parent = null;
}
current: 'tab',
},
props: {
dot: {

View File

@ -10,7 +10,8 @@ component_1.VantComponent({
},
relation: {
name: 'tabbar',
type: 'ancestor'
type: 'ancestor',
current: 'tabbar-item',
},
data: {
active: false

View File

@ -5,13 +5,12 @@ component_1.VantComponent({
relation: {
name: 'tabbar-item',
type: 'descendant',
current: 'tabbar',
linked: function (target) {
this.children.push(target);
target.parent = this;
target.updateFromParent();
},
unlinked: function (target) {
this.children = this.children.filter(function (item) { return item !== target; });
unlinked: function () {
this.updateChildren();
}
},
@ -45,9 +44,6 @@ component_1.VantComponent({
value: true
}
},
beforeCreate: function () {
this.children = [];
},
methods: {
updateChildren: function () {
var children = this.children;

View File

@ -9,14 +9,13 @@ component_1.VantComponent({
relation: {
name: 'tab',
type: 'descendant',
current: 'tabs',
linked: function (target) {
target.index = this.children.length;
this.children.push(target);
target.index = this.children.length - 1;
this.updateTabs();
},
unlinked: function (target) {
unlinked: function () {
this.children = this.children
.filter(function (child) { return child !== target; })
.map(function (child, index) {
child.index = index;
return child;
@ -108,16 +107,14 @@ component_1.VantComponent({
currentIndex: null,
container: null
},
beforeCreate: function () {
this.children = [];
},
mounted: function () {
var _this = this;
this.setData({
container: function () { return _this.createSelectorQuery().select('.van-tabs'); }
}, function () {
_this.setLine(true);
_this.scrollIntoView();
});
this.setLine(true);
this.scrollIntoView();
},
methods: {
updateTabs: function () {
@ -128,16 +125,16 @@ component_1.VantComponent({
});
this.setCurrentIndexByName(this.getCurrentName() || data.active);
},
trigger: function (eventName) {
trigger: function (eventName, child) {
var currentIndex = this.data.currentIndex;
var child = this.children[currentIndex];
if (!utils_1.isDef(child)) {
var currentChild = child || this.children[currentIndex];
if (!utils_1.isDef(currentChild)) {
return;
}
this.$emit(eventName, {
index: currentIndex,
name: child.getComputedName(),
title: child.data.title
index: currentChild.index,
name: currentChild.getComputedName(),
title: currentChild.data.title
});
},
onTap: function (event) {
@ -145,7 +142,7 @@ component_1.VantComponent({
var index = event.currentTarget.dataset.index;
var child = this.children[index];
if (child.data.disabled) {
this.trigger('disabled');
this.trigger('disabled', child);
}
else {
this.setCurrentIndex(index);