[build] 0.4.7

This commit is contained in:
陈嘉涵 2018-11-26 09:51:15 +08:00
parent 61c95ee94d
commit 6d8f03e205
43 changed files with 424 additions and 93 deletions

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;color:#333}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;font-size:16px;line-height:50px;text-align:center;background-color:#fff}.van-action-sheet__cancel:active,.van-action-sheet__item:active{background-color:#e8e8e8}.van-action-sheet__cancel{height:60px}.van-action-sheet__cancel::before{display:block;content:' ';height:10px;background-color:#f8f8f8}.van-action-sheet__item--disabled{color:#c9c9c9}.van-action-sheet__item--disabled:active{background-color:#fff}.van-action-sheet__subname{margin-left:5px;font-size:12px;color:#666}.van-action-sheet__header{font-size:16px;font-weight:500;line-height:44px;text-align:center}.van-action-sheet__close{position:absolute!important;top:0;right:0;padding:0 15px;font-size:18px!important;line-height:inherit!important;color:#999}
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;color:#333}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;font-size:16px;line-height:50px;text-align:center;background-color:#fff}.van-action-sheet__cancel:active,.van-action-sheet__item:active{background-color:#e8e8e8}.van-action-sheet__cancel{height:60px}.van-action-sheet__cancel::before{display:block;content:' ';height:10px;background-color:#f8f8f8}.van-action-sheet__item--disabled{color:#c9c9c9}.van-action-sheet__item--disabled:active{background-color:#fff}.van-action-sheet__subname{margin-left:5px;font-size:12px;color:#7d7e80}.van-action-sheet__header{font-size:16px;font-weight:500;line-height:44px;text-align:center}.van-action-sheet__close{position:absolute!important;top:0;right:0;padding:0 15px;font-size:18px!important;line-height:inherit!important;color:#999}

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-badge{display:block;overflow:hidden;font-size:14px;line-height:1.4;-webkit-user-select:none;user-select:none;color:#666;word-break:break-all;box-sizing:border-box;padding:20px 12px 20px 9px;background-color:#f8f8f8;border-left:3px solid transparent}.van-badge:active{background-color:#e8e8e8}.van-badge::after{border-bottom-width:1px}.van-badge--active{font-weight:700;color:#333;border-color:#f44}.van-badge--active::after{border-right-width:1px}.van-badge--active,.van-badge--active:active{background-color:#fff}.van-badge__info{position:absolute;top:4px;right:2px;color:#fff;font-size:12px;font-weight:500;-webkit-transform:scale(.8);transform:scale(.8);text-align:center;box-sizing:border-box;padding:0 6px;min-width:18px;line-height:18px;border-radius:9px;background-color:#f44}
@import '../common/index.wxss';.van-badge{display:block;overflow:hidden;font-size:14px;line-height:1.4;-webkit-user-select:none;user-select:none;color:#7d7e80;word-break:break-all;box-sizing:border-box;padding:20px 12px 20px 9px;background-color:#f8f8f8;border-left:3px solid transparent}.van-badge:active{background-color:#e8e8e8}.van-badge::after{border-bottom-width:1px}.van-badge--active{font-weight:700;color:#333;border-color:#f44}.van-badge--active::after{border-right-width:1px}.van-badge--active,.van-badge--active:active{background-color:#fff}.van-badge__info{position:absolute;top:4px;right:2px;color:#fff;font-size:12px;font-weight:500;-webkit-transform:scale(.8);transform:scale(.8);text-align:center;box-sizing:border-box;padding:0 6px;min-width:18px;line-height:18px;border-radius:9px;background-color:#f44}

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-card{box-sizing:border-box;position:relative;height:100px;font-size:12px;color:#333;padding:5px 15px 5px 115px;background:#fafafa}.van-card--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:absolute;top:5px;left:15px;width:90px;height:90px}.van-card__img{width:100%;height:100%}.van-card,.van-card__content{display:-webkit-flex;display:flex}.van-card__content{width:100%}.van-card__desc,.van-card__title{line-height:20px;word-break:break-all}.van-card__title{max-height:40px}.van-card__desc{max-height:20px;color:#666}.van-card__left{-webkit-flex:1;flex:1;min-width:0}.van-card__right{-webkit-flex:none;flex:none;padding-left:10px;line-height:20px;text-align:right}.van-card__origin-price{color:#666;text-decoration:line-through}.van-card__num{color:#666}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{position:absolute;right:15px;bottom:5px}.van-card__footer .van-button{margin-left:5px}
@import '../common/index.wxss';.van-card{box-sizing:border-box;position:relative;height:100px;font-size:12px;color:#333;padding:5px 15px 5px 115px;background:#fafafa}.van-card--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:absolute;top:5px;left:15px;width:90px;height:90px}.van-card__img{width:100%;height:100%}.van-card,.van-card__content{display:-webkit-flex;display:flex}.van-card__content{width:100%}.van-card__desc,.van-card__title{line-height:20px;word-break:break-all}.van-card__title{max-height:40px}.van-card__desc{max-height:20px;color:#7d7e80}.van-card__left{-webkit-flex:1;flex:1;min-width:0}.van-card__right{-webkit-flex:none;flex:none;padding-left:10px;line-height:20px;text-align:right}.van-card__origin-price{color:#7d7e80;text-decoration:line-through}.van-card__num{color:#7d7e80}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{position:absolute;right:15px;bottom:5px}.van-card__footer .van-button{margin-left:5px}

8
dist/cell/index.js vendored
View File

@ -1,12 +1,13 @@
import { link } from '../mixins/link';
import { VantComponent } from '../common/component';
VantComponent({
classes: ['title-class', 'label-class', 'value-class'],
classes: ['title-class', 'label-class', 'value-class', 'right-icon-class'],
mixins: [link],
props: {
title: null,
value: null,
icon: String,
size: String,
label: String,
center: Boolean,
isLink: Boolean,
@ -27,7 +28,8 @@ VantComponent({
'van-cell--center': data.center,
'van-cell--required': data.required,
'van-cell--borderless': !data.border,
'van-cell--clickable': data.isLink || data.clickable
'van-cell--clickable': data.isLink || data.clickable,
["van-cell--" + data.size]: data.size
});
},
titleStyle: function titleStyle() {
@ -35,7 +37,7 @@ VantComponent({
return titleWidth ? "max-width: " + titleWidth + ";min-width: " + titleWidth : '';
},
iconWrapClass: function iconWrapClass() {
var prefix = 'van-cell__right-icon-wrap';
var prefix = 'van-cell__right-icon-wrap right-icon-class';
return this.classNames(prefix, prefix + "--" + this.data.arrowDirection);
}
},

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-cell{width:100%;display:-webkit-flex;display:flex;padding:10px 15px;box-sizing:border-box;line-height:24px;position:relative;background-color:#fff;color:#333;font-size:14px}.van-cell::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:auto;left:15px;right:0;bottom:0;-webkit-transform:scaleY(.5);transform:scaleY(.5);border-bottom:1px solid #eee}.van-cell--borderless::after{display:none}.van-cell-group{background-color:#fff}.van-cell__label{font-size:12px;line-height:1.2;color:#666}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px}.van-cell__left-icon-wrap{margin-right:5px}.van-cell__right-icon-wrap{margin-left:5px}.van-cell__right-icon-wrap--left{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.van-cell__right-icon-wrap--up{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-cell__right-icon-wrap--down{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.van-cell__left-icon{font-size:16px!important;line-height:24px;vertical-align:middle}.van-cell__right-icon{color:#999;font-size:12px!important;line-height:24px}.van-cell--clickable:active{background-color:#e8e8e8}.van-cell--required{overflow:visible}.van-cell--required::before{content:'*';position:absolute;left:7px;font-size:14px;color:#f44}.van-cell--center{-webkit-align-items:center;align-items:center}
@import '../common/index.wxss';.van-cell{width:100%;display:-webkit-flex;display:flex;padding:10px 15px;box-sizing:border-box;line-height:24px;position:relative;background-color:#fff;color:#333;font-size:14px}.van-cell::after{content:' ';position:absolute;pointer-events:none;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;top:auto;left:15px;right:0;bottom:0;-webkit-transform:scaleY(.5);transform:scaleY(.5);border-bottom:1px solid #eee}.van-cell--borderless::after{display:none}.van-cell-group{background-color:#fff}.van-cell__label{font-size:12px;line-height:18px;color:#7d7e80}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px}.van-cell__left-icon-wrap{margin-right:5px;font-size:16px}.van-cell__right-icon-wrap{margin-left:5px;font-size:12px;color:#999}.van-cell__right-icon-wrap--left{-webkit-transform:rotate(180deg);transform:rotate(180deg)}.van-cell__right-icon-wrap--up{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-cell__right-icon-wrap--down{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.van-cell__left-icon{line-height:24px;vertical-align:middle}.van-cell__right-icon{line-height:24px}.van-cell--clickable:active{background-color:#e8e8e8}.van-cell--required{overflow:visible}.van-cell--required::before{content:'*';position:absolute;left:7px;font-size:14px;color:#f44}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-bottom:12px}.van-cell--large .van-cell__title{font-size:16px}

95
dist/collapse-item/index.js vendored Normal file
View File

@ -0,0 +1,95 @@
import { VantComponent } from '../common/component';
VantComponent({
classes: ['content-class'],
relation: {
name: 'collapse',
type: 'ancestor',
linked: function linked(parent) {
this.parent = parent;
}
},
props: {
name: [String, Number],
icon: String,
label: String,
title: [String, Number],
value: [String, Number],
disabled: Boolean,
border: {
type: Boolean,
value: true
},
isLink: {
type: Boolean,
value: true
}
},
data: {
contentHeight: 0,
expanded: false
},
computed: {
titleClass: function titleClass() {
var _this$data = this.data,
disabled = _this$data.disabled,
expanded = _this$data.expanded;
return this.classNames('van-collapse-item__title', {
'van-collapse-item__title--disabled': disabled,
'van-collapse-item__title--expanded': expanded
});
}
},
methods: {
updateExpanded: function updateExpanded() {
if (!this.parent) {
return null;
}
var _this$parent$data = this.parent.data,
value = _this$parent$data.value,
accordion = _this$parent$data.accordion,
items = _this$parent$data.items;
var name = this.data.name;
var index = items.indexOf(this);
var currentName = name == null ? index : name;
var expanded = accordion ? value === currentName : value.some(function (name) {
return name === currentName;
});
if (expanded !== this.data.expanded) {
this.updateStyle(expanded);
}
this.setData({
expanded: expanded
});
},
updateStyle: function updateStyle(expanded) {
var _this = this;
if (expanded) {
this.getRect('.van-collapse-item__content').then(function (res) {
_this.setData({
contentHeight: res.height ? res.height + 'px' : null
});
});
} else {
this.setData({
contentHeight: 0
});
}
},
onClick: function onClick() {
if (this.data.disabled) {
return;
}
var _this$data2 = this.data,
name = _this$data2.name,
expanded = _this$data2.expanded;
var index = this.parent.data.items.indexOf(this);
var currentName = name == null ? index : name;
this.parent.switch(currentName, !expanded);
}
}
});

6
dist/collapse-item/index.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-cell": "../cell/index"
}
}

39
dist/collapse-item/index.wxml vendored Normal file
View File

@ -0,0 +1,39 @@
<view class="van-collapse-item van-hairline--top custom-class">
<van-cell
title="{{ title }}"
icon="{{ icon }}"
is-link="{{ isLink }}"
value="{{ value }}"
label="{{ label }}"
border="{{ border && expanded }}"
class="{{ titleClass }}"
right-icon-class="van-cell__right-icon"
custom-class="van-cell"
arrow-direction="{{ expanded ? 'up' : 'down' }}"
bind:click="onClick"
>
<slot
name="title"
slot="title"
/>
<slot
name="icon"
slot="icon"
/>
<slot name="value" />
<slot
name="right-icon"
slot="right-icon"
/>
</van-cell>
<view
class="van-collapse-item__wrapper"
style="max-height: {{ contentHeight }};"
>
<view
class="van-collapse-item__content content-class"
>
<slot />
</view>
</view>
</view>

1
dist/collapse-item/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
@import '../common/index.wxss';.van-collapse-item__title .van-cell__right-icon{-webkit-transform:rotate(90deg);transform:rotate(90deg);transition:.3s}.van-collapse-item__title--expanded .van-cell__right-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-collapse-item__title--disabled .van-cell,.van-collapse-item__title--disabled .van-cell__right-icon{color:#c9c9c9!important}.van-collapse-item__title--disabled:active{background-color:#fff!important}.van-collapse-item__wrapper{overflow:hidden;will-change:max-height;transition:max-height .3s ease-in-out}.van-collapse-item__content{padding:15px;background-color:#fff}

51
dist/collapse/index.js vendored Normal file
View File

@ -0,0 +1,51 @@
import { VantComponent } from '../common/component';
VantComponent({
relation: {
name: 'collapse-item',
type: 'descendant',
linked: function linked(child) {
this.setData({
items: this.data.items.concat([child])
}, function () {
child.updateExpanded();
});
}
},
props: {
accordion: Boolean,
value: null
},
data: {
items: []
},
watch: {
value: function value() {
this.data.items.forEach(function (child) {
child.updateExpanded();
});
},
accordion: function accordion() {
this.data.items.forEach(function (child) {
child.updateExpanded();
});
}
},
methods: {
switch: function _switch(name, expanded) {
var _this$data = this.data,
accordion = _this$data.accordion,
value = _this$data.value;
if (!accordion) {
name = expanded ? value.concat(name) : value.filter(function (activeName) {
return activeName !== name;
});
} else {
name = expanded ? name : '';
}
this.$emit('change', name);
this.$emit('input', name);
}
}
});

3
dist/collapse/index.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"component": true
}

3
dist/collapse/index.wxml vendored Normal file
View File

@ -0,0 +1,3 @@
<view class="van-collapse van-hairline--top-bottom custom-class">
<slot />
</view>

View File

@ -1,8 +1,9 @@
import { VantComponent } from '../common/component';
import { isDef } from '../common/utils';
var currentYear = new Date().getFullYear();
var isValidDate = function isValidDate(date) {
return !isNaN(new Date(date).getTime());
return isDef(date) && !isNaN(new Date(date).getTime());
};
function range(num, min, max) {
@ -165,8 +166,8 @@ VantComponent({
if (isDateType && !isValidDate(value)) {
value = data.minDate;
} else if (!isDateType && !value) {
var _minHour = data.minHour;
value = pad(_minHour) + ":00";
var minHour = data.minHour;
value = pad(minHour) + ":00";
} // time type
@ -181,24 +182,8 @@ VantComponent({
} // date type
var _this$getBoundary3 = this.getBoundary('max', value),
maxYear = _this$getBoundary3.maxYear,
maxDate = _this$getBoundary3.maxDate,
maxMonth = _this$getBoundary3.maxMonth,
maxHour = _this$getBoundary3.maxHour,
maxMinute = _this$getBoundary3.maxMinute;
var _this$getBoundary4 = this.getBoundary('min', value),
minYear = _this$getBoundary4.minYear,
minDate = _this$getBoundary4.minDate,
minMonth = _this$getBoundary4.minMonth,
minHour = _this$getBoundary4.minHour,
minMinute = _this$getBoundary4.minMinute;
var minDay = new Date(minYear, minMonth - 1, minDate, minHour, minMinute);
var maxDay = new Date(maxYear, maxMonth - 1, maxDate, maxHour, maxMinute);
value = Math.max(value, minDay.getTime());
value = Math.min(value, maxDay.getTime());
value = Math.max(value, data.minDate);
value = Math.min(value, data.maxDate);
return value;
},
times: function times(n, iteratee) {

12
dist/dialog/dialog.js vendored
View File

@ -2,11 +2,15 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
var queue = [];
function getContext() {
var pages = getCurrentPages();
return pages[pages.length - 1];
}
var Dialog = function Dialog(options) {
return new Promise(function (resolve, reject) {
var pages = getCurrentPages();
var ctx = pages[pages.length - 1];
var dialog = ctx.selectComponent(options.selector);
var context = options.context || getContext();
var dialog = context.selectComponent(options.selector);
delete options.selector;
if (dialog) {
@ -15,6 +19,8 @@ var Dialog = function Dialog(options) {
onConfirm: resolve
}, options));
queue.push(dialog);
} else {
console.warn('未找到 van-dialog 节点,请确认 selector 及 context 是否正确');
}
});
};

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-dialog{width:85%;font-size:16px;overflow:hidden;border-radius:4px;background-color:#fff}.van-dialog__header{font-weight:500;padding-top:25px;text-align:center}.van-dialog__header--isolated{padding:25px 0}.van-dialog__message{padding:25px;font-size:14px;line-height:1.5}.van-dialog__message--has-title{padding-top:12px;color:#666}.van-dialog__footer{display:-webkit-flex;display:flex}.van-dialog__button{-webkit-flex:1;flex:1}.van-dialog__cancel,.van-dialog__confirm{border:0!important}.van-dialog__confirm,.van-dialog__confirm:active{color:#1989fa!important}.van-dialog-bounce-enter{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7)}.van-dialog-bounce-leave-active{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9)}
@import '../common/index.wxss';.van-dialog{width:85%;font-size:16px;overflow:hidden;border-radius:4px;background-color:#fff}.van-dialog__header{font-weight:500;padding-top:25px;text-align:center}.van-dialog__header--isolated{padding:25px 0}.van-dialog__message{padding:25px;font-size:14px;line-height:1.5;max-height:60vh;overflow-y:auto;-webkit-overflow-scrolling:touch}.van-dialog__message--has-title{padding-top:12px;color:#7d7e80}.van-dialog__footer{display:-webkit-flex;display:flex}.van-dialog__button{-webkit-flex:1;flex:1}.van-dialog__cancel,.van-dialog__confirm{border:0!important}.van-dialog__confirm,.van-dialog__confirm:active{color:#1989fa!important}.van-dialog-bounce-enter{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7)}.van-dialog-bounce-leave-active{opacity:0;-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9)}

2
dist/field/index.js vendored
View File

@ -6,6 +6,7 @@ VantComponent({
icon: String,
label: String,
error: Boolean,
fixed: Boolean,
focus: Boolean,
center: Boolean,
isLink: Boolean,
@ -104,6 +105,7 @@ VantComponent({
});
this.$emit('input', '');
this.$emit('change', '');
this.$emit('clear', '');
},
onConfirm: function onConfirm() {
this.$emit('confirm', this.data.value);

View File

@ -14,6 +14,7 @@
<textarea
wx:if="{{ type === 'textarea' }}"
class="{{ inputClass }}"
fixed="{{ fixed }}"
focus="{{ focus }}"
value="{{ value }}"
disabled="{{ disabled || readonly }}"

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{min-height:24px}.van-field__input{border:0;margin:0;padding:0;width:100%;height:24px;resize:none;display:block;text-align:left;min-height:24px;line-height:inherit;box-sizing:border-box;background-color:transparent}.van-field__input--disabled{opacity:1;color:#666;background-color:transparent}.van-field__input--center{text-align:center}.van-field__input--right{text-align:right}.van-field__clear-root{height:24px}.van-field__button,.van-field__clear,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear,.van-field__icon-container{padding:0 10px;line-height:inherit;margin-right:-10px;vertical-align:middle}.van-field__clear{color:#c9c9c9}.van-field__icon-container{color:#999}.van-field__icon{display:block!important}.van-field__button{padding-left:10px}.van-field__error-message{color:#f44;font-size:12px;text-align:left}.van-field--error{color:#f44}
@import '../common/index.wxss';.van-field__body{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center}.van-field__body--textarea{min-height:24px}.van-field__input{border:0;margin:0;padding:0;width:100%;height:24px;resize:none;display:block;text-align:left;min-height:24px;line-height:inherit;box-sizing:border-box;background-color:transparent}.van-field__input--disabled{opacity:1;color:#7d7e80;background-color:transparent}.van-field__input--center{text-align:center}.van-field__input--right{text-align:right}.van-field__clear-root{height:24px}.van-field__button,.van-field__clear,.van-field__icon-container{-webkit-flex-shrink:0;flex-shrink:0}.van-field__clear,.van-field__icon-container{padding:0 10px;line-height:inherit;margin-right:-10px;vertical-align:middle}.van-field__clear{color:#c9c9c9}.van-field__icon-container{color:#999}.van-field__icon{display:block!important}.van-field__button{padding-left:10px}.van-field__error-message{color:#f44;font-size:12px;text-align:left}.van-field--error{color:#f44}

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-goods-action-icon{width:50px!important;border:none!important}.van-goods-action-icon__content{height:100%;display:-webkit-flex;display:flex;line-height:1;font-size:10px;color:#666;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}.van-goods-action-icon__icon{margin-bottom:5px}
@import '../common/index.wxss';.van-goods-action-icon{width:50px!important;border:none!important}.van-goods-action-icon__content{height:100%;display:-webkit-flex;display:flex;line-height:1;font-size:10px;color:#7d7e80;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}.van-goods-action-icon__icon{margin-bottom:5px}

View File

@ -1 +1 @@
@import '../common/index.wxss';@font-face{font-style:normal;font-weight:400;font-family:vant-icon;src:url(https://img.yzcdn.cn/vant/vant-icon-872dd0.ttf) format('truetype')}.van-icon{position:relative;display:inline-block;font:normal normal normal 14px/1 vant-icon;font-size:inherit;text-rendering:auto}.van-icon__info{color:#fff;left:100%;top:-.5em;font-size:.6em;padding:0 .25em;text-align:center;min-width:1.4em;line-height:1.4;position:absolute;border-radius:.6em;box-sizing:border-box;background-color:#f44;-webkit-transform:translateX(-50%);transform:translateX(-50%);font-family:PingFang SC,Helvetica Neue,Arial,sans-serif}.van-icon::before{display:inline-block}.van-icon-add-o::before{content:"\F000"}.van-icon-add::before{content:"\F001"}.van-icon-add2::before{content:"\F002"}.van-icon-after-sale::before{content:"\F003"}.van-icon-aim::before{content:"\F004"}.van-icon-alipay::before{content:"\F005"}.van-icon-arrow-left::before{content:"\F006"}.van-icon-arrow::before{content:"\F007"}.van-icon-balance-pay::before{content:"\F008"}.van-icon-browsing-history::before{content:"\F009"}.van-icon-card::before{content:"\F00A"}.van-icon-cart-o::before{content:"\F00B"}.van-icon-cart::before{content:"\F00C"}.van-icon-cash-back-record::before{content:"\F00D"}.van-icon-cash-on-deliver::before{content:"\F00E"}.van-icon-certificate::before{content:"\F00F"}.van-icon-chat::before{content:"\F010"}.van-icon-check::before{content:"\F011"}.van-icon-checked::before{content:"\F012"}.van-icon-clear::before{content:"\F013"}.van-icon-clock::before{content:"\F014"}.van-icon-close::before{content:"\F015"}.van-icon-completed::before{content:"\F016"}.van-icon-contact::before{content:"\F017"}.van-icon-coupon::before{content:"\F018"}.van-icon-credit-pay::before{content:"\F019"}.van-icon-debit-pay::before{content:"\F01A"}.van-icon-delete::before{content:"\F01B"}.van-icon-description::before{content:"\F01C"}.van-icon-discount::before{content:"\F01D"}.van-icon-ecard-pay::before{content:"\F01E"}.van-icon-edit-data::before{content:"\F01F"}.van-icon-edit::before{content:"\F020"}.van-icon-exchange-record::before{content:"\F021"}.van-icon-exchange::before{content:"\F022"}.van-icon-fail::before{content:"\F023"}.van-icon-free-postage::before{content:"\F024"}.van-icon-gift-card-pay::before{content:"\F025"}.van-icon-gift-card::before{content:"\F026"}.van-icon-gift::before{content:"\F027"}.van-icon-gold-coin::before{content:"\F028"}.van-icon-goods-collect::before{content:"\F029"}.van-icon-home::before{content:"\F02A"}.van-icon-hot-sale::before{content:"\F02B"}.van-icon-hot::before{content:"\F02C"}.van-icon-idcard::before{content:"\F02D"}.van-icon-info-o::before{content:"\F02E"}.van-icon-like-o::before{content:"\F02F"}.van-icon-like::before{content:"\F030"}.van-icon-location::before{content:"\F031"}.van-icon-logistics::before{content:"\F032"}.van-icon-more-o::before{content:"\F033"}.van-icon-more::before{content:"\F034"}.van-icon-new-arrival::before{content:"\F035"}.van-icon-new::before{content:"\F036"}.van-icon-other-pay::before{content:"\F037"}.van-icon-passed::before{content:"\F038"}.van-icon-password-not-view::before{content:"\F039"}.van-icon-password-view::before{content:"\F03A"}.van-icon-pause::before{content:"\F03B"}.van-icon-peer-pay::before{content:"\F03C"}.van-icon-pending-deliver::before{content:"\F03D"}.van-icon-pending-evaluate::before{content:"\F03E"}.van-icon-pending-orders::before{content:"\F03F"}.van-icon-pending-payment::before{content:"\F040"}.van-icon-phone::before{content:"\F041"}.van-icon-photo::before{content:"\F042"}.van-icon-photograph::before{content:"\F043"}.van-icon-play::before{content:"\F044"}.van-icon-point-gift::before{content:"\F045"}.van-icon-points-mall::before{content:"\F046"}.van-icon-points::before{content:"\F047"}.van-icon-qr-invalid::before{content:"\F048"}.van-icon-qr::before{content:"\F049"}.van-icon-question::before{content:"\F04A"}.van-icon-question2::before{content:"\F04B"}.van-icon-receive-gift::before{content:"\F04C"}.van-icon-records::before{content:"\F04D"}.van-icon-search::before{content:"\F04E"}.van-icon-send-gift::before{content:"\F04F"}.van-icon-setting::before{content:"\F050"}.van-icon-share::before{content:"\F051"}.van-icon-shop-collect::before{content:"\F052"}.van-icon-shop::before{content:"\F053"}.van-icon-shopping-cart::before{content:"\F054"}.van-icon-sign::before{content:"\F055"}.van-icon-stop::before{content:"\F056"}.van-icon-success::before{content:"\F057"}.van-icon-tosend::before{content:"\F058"}.van-icon-underway::before{content:"\F059"}.van-icon-upgrade::before{content:"\F05A"}.van-icon-value-card::before{content:"\F05B"}.van-icon-wap-home::before{content:"\F05C"}.van-icon-wap-nav::before{content:"\F05D"}.van-icon-warn::before{content:"\F05E"}.van-icon-wechat::before{content:"\F05F"}
@import '../common/index.wxss';@font-face{font-style:normal;font-weight:400;font-family:vant-icon;src:url(https://img.yzcdn.cn/vant/vant-icon-1ef3b9.ttf) format('truetype')}.van-icon{position:relative;display:inline-block;font:normal normal normal 14px/1 vant-icon;font-size:inherit;text-rendering:auto}.van-icon__info{color:#fff;left:100%;top:-.5em;font-size:.6em;padding:0 .25em;text-align:center;min-width:1.4em;line-height:1.4;position:absolute;border-radius:.6em;box-sizing:border-box;background-color:#f44;-webkit-transform:translateX(-50%);transform:translateX(-50%);font-family:PingFang SC,Helvetica Neue,Arial,sans-serif}.van-icon::before{display:inline-block}.van-icon-add-o::before{content:"\F000"}.van-icon-add::before{content:"\F001"}.van-icon-add2::before{content:"\F002"}.van-icon-after-sale::before{content:"\F003"}.van-icon-aim::before{content:"\F004"}.van-icon-alipay::before{content:"\F005"}.van-icon-arrow-left::before{content:"\F006"}.van-icon-arrow::before{content:"\F007"}.van-icon-balance-pay::before{content:"\F008"}.van-icon-browsing-history::before{content:"\F009"}.van-icon-card::before{content:"\F00A"}.van-icon-cart-o::before{content:"\F00B"}.van-icon-cart::before{content:"\F00C"}.van-icon-cash-back-record::before{content:"\F00D"}.van-icon-cash-on-deliver::before{content:"\F00E"}.van-icon-certificate::before{content:"\F00F"}.van-icon-chat::before{content:"\F010"}.van-icon-check::before{content:"\F011"}.van-icon-checked::before{content:"\F012"}.van-icon-clear::before{content:"\F013"}.van-icon-clock::before{content:"\F014"}.van-icon-close::before{content:"\F015"}.van-icon-completed::before{content:"\F016"}.van-icon-contact::before{content:"\F017"}.van-icon-coupon::before{content:"\F018"}.van-icon-credit-pay::before{content:"\F019"}.van-icon-debit-pay::before{content:"\F01A"}.van-icon-delete::before{content:"\F01B"}.van-icon-description::before{content:"\F01C"}.van-icon-discount::before{content:"\F01D"}.van-icon-ecard-pay::before{content:"\F01E"}.van-icon-edit-data::before{content:"\F01F"}.van-icon-edit::before{content:"\F020"}.van-icon-exchange-record::before{content:"\F021"}.van-icon-exchange::before{content:"\F022"}.van-icon-fail::before{content:"\F023"}.van-icon-free-postage::before{content:"\F024"}.van-icon-gift-card-pay::before{content:"\F025"}.van-icon-gift-card::before{content:"\F026"}.van-icon-gift::before{content:"\F027"}.van-icon-gold-coin::before{content:"\F028"}.van-icon-goods-collect::before{content:"\F029"}.van-icon-home::before{content:"\F02A"}.van-icon-hot-sale::before{content:"\F02B"}.van-icon-hot::before{content:"\F02C"}.van-icon-idcard::before{content:"\F02D"}.van-icon-info-o::before{content:"\F02E"}.van-icon-like-o::before{content:"\F02F"}.van-icon-like::before{content:"\F030"}.van-icon-location::before{content:"\F031"}.van-icon-logistics::before{content:"\F032"}.van-icon-more-o::before{content:"\F033"}.van-icon-more::before{content:"\F034"}.van-icon-new-arrival::before{content:"\F035"}.van-icon-new::before{content:"\F036"}.van-icon-other-pay::before{content:"\F037"}.van-icon-passed::before{content:"\F038"}.van-icon-password-not-view::before{content:"\F039"}.van-icon-password-view::before{content:"\F03A"}.van-icon-pause::before{content:"\F03B"}.van-icon-peer-pay::before{content:"\F03C"}.van-icon-pending-deliver::before{content:"\F03D"}.van-icon-pending-evaluate::before{content:"\F03E"}.van-icon-pending-orders::before{content:"\F03F"}.van-icon-pending-payment::before{content:"\F040"}.van-icon-phone::before{content:"\F041"}.van-icon-photo::before{content:"\F042"}.van-icon-photograph::before{content:"\F043"}.van-icon-play::before{content:"\F044"}.van-icon-point-gift::before{content:"\F045"}.van-icon-points-mall::before{content:"\F046"}.van-icon-points::before{content:"\F047"}.van-icon-qr-invalid::before{content:"\F048"}.van-icon-qr::before{content:"\F049"}.van-icon-question::before{content:"\F04A"}.van-icon-question2::before{content:"\F04B"}.van-icon-receive-gift::before{content:"\F04C"}.van-icon-records::before{content:"\F04D"}.van-icon-search::before{content:"\F04E"}.van-icon-send-gift::before{content:"\F04F"}.van-icon-setting::before{content:"\F050"}.van-icon-share::before{content:"\F051"}.van-icon-shop-collect::before{content:"\F052"}.van-icon-shop::before{content:"\F053"}.van-icon-shopping-cart::before{content:"\F054"}.van-icon-sign::before{content:"\F055"}.van-icon-star-o::before{content:"\F056"}.van-icon-star::before{content:"\F057"}.van-icon-stop::before{content:"\F058"}.van-icon-success::before{content:"\F059"}.van-icon-tosend::before{content:"\F05A"}.van-icon-underway::before{content:"\F05B"}.van-icon-upgrade::before{content:"\F05C"}.van-icon-value-card::before{content:"\F05D"}.van-icon-wap-home::before{content:"\F05E"}.van-icon-wap-nav::before{content:"\F05F"}.van-icon-warn::before{content:"\F060"}.van-icon-wechat::before{content:"\F061"}

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-notify{top:0;width:100%;z-index:110;color:#fff;position:fixed;min-height:32px;line-height:2.3;font-size:14px;text-align:center}
@import '../common/index.wxss';.van-notify{z-index:110;position:fixed;top:0;width:100%;text-align:center;box-sizing:border-box;padding:6px 15px;font-size:14px;line-height:20px}

18
dist/notify/notify.js vendored
View File

@ -10,19 +10,25 @@ function parseOptions(text) {
};
}
function getContext() {
var pages = getCurrentPages();
return pages[pages.length - 1];
}
export default function Notify(options) {
if (options === void 0) {
options = {};
}
var pages = getCurrentPages();
var ctx = pages[pages.length - 1];
options = Object.assign({}, defaultOptions, parseOptions(options));
var el = ctx.selectComponent(options.selector);
var context = options.context || getContext();
var notify = context.selectComponent(options.selector);
delete options.selector;
if (el) {
el.setData(options);
el.show();
if (notify) {
notify.setData(options);
notify.show();
} else {
console.warn('未找到 van-notify 节点,请确认 selector 及 context 是否正确');
}
}

3
dist/radio/index.js vendored
View File

@ -11,7 +11,8 @@ VantComponent({
value: null,
disabled: Boolean,
labelDisabled: Boolean,
labelPosition: String
labelPosition: String,
checkedColor: String
},
computed: {
iconClass: function iconClass() {

View File

@ -8,7 +8,12 @@
class="van-radio__control"
/>
</radio-group>
<van-icon class="{{ iconClass }}" custom-class="icon-class" name="{{ value === name ? 'checked' : 'check' }}" />
<van-icon
class="{{ iconClass }}"
custom-class="icon-class"
color="{{ value === name ? checkedColor : '' }}"
name="{{ value === name ? 'checked' : 'check' }}"
/>
</view>
<view class="van-radio__label van-radio__label--{{ labelPosition }} label-class" bindtap="onClickLabel">
<slot />

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-radio{overflow:hidden;line-height:1;-webkit-user-select:none;user-select:none}.van-radio__input,.van-radio__label{display:inline-block;vertical-align:middle}.van-radio__input{position:relative;font-size:20px}.van-radio__control{z-index:1;position:absolute;top:0;left:0;width:100%;height:100%;margin:0;opacity:0}.van-radio__label{margin-left:10px;color:#333;font-size:16px;line-height:20px}.van-radio__label--left{margin:0 10px 0 0;float:left}.van-radio__icon{pointer-events:none;display:block;line-height:0}.van-radio__icon--disabled{color:#e5e5e5}.van-radio__icon--checked{color:#1989fa}.van-radio__icon--check{color:#999}
@import '../common/index.wxss';.van-radio{overflow:hidden;line-height:1;-webkit-user-select:none;user-select:none}.van-radio__input,.van-radio__label{display:inline-block;vertical-align:middle}.van-radio__input{position:relative;font-size:20px}.van-radio__control{z-index:1;position:absolute;top:0;left:0;width:100%;height:100%;margin:0;opacity:0}.van-radio__label{margin-left:10px;color:#333;font-size:16px;line-height:20px}.van-radio__label--left{margin:0 10px 0 0;float:left}.van-radio__label:empty{margin:0}.van-radio__icon{pointer-events:none;display:block;line-height:0}.van-radio__icon--disabled{color:#e5e5e5}.van-radio__icon--checked{color:#1989fa}.van-radio__icon--check{color:#999}

90
dist/rate/index.js vendored Normal file
View File

@ -0,0 +1,90 @@
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import { VantComponent } from '../common/component';
VantComponent({
field: true,
props: {
readonly: Boolean,
disabled: Boolean,
size: {
type: Number,
value: 20
},
color: {
type: String,
value: '#ffd21e'
},
voidColor: {
type: String,
value: '#c7c7c7'
},
disabledColor: {
type: String,
value: '#bdbdbd'
},
count: {
type: Number,
value: 5
},
value: {
type: Number,
value: 0
}
},
data: {
innerValue: 0
},
watch: {
value: function value(_value) {
if (_value !== this.data.innerValue) {
this.setData({
innerValue: _value
});
}
}
},
computed: {
list: function list() {
var _this$data = this.data,
count = _this$data.count,
innerValue = _this$data.innerValue;
return Array.from({
length: count
}, function (_, index) {
return index < innerValue;
});
}
},
methods: {
onSelect: function onSelect(event) {
var data = this.data;
var index = event.currentTarget.dataset.index;
if (!data.disabled && !data.readonly) {
this.setData({
innerValue: index + 1
});
this.$emit('input', index + 1);
this.$emit('change', index + 1);
}
},
onTouchMove: function onTouchMove(event) {
var _this = this;
var _event$touches$ = event.touches[0],
clientX = _event$touches$.clientX,
clientY = _event$touches$.clientY;
this.getRect('.van-rate__item', true).then(function (list) {
var target = list.find(function (item) {
return clientX >= item.left && clientX <= item.right && clientY >= item.top && clientY <= item.bottom;
});
if (target != null) {
_this.onSelect(_extends({}, event, {
currentTarget: target
}));
}
});
}
}
});

6
dist/rate/index.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-icon": "../icon/index"
}
}

15
dist/rate/index.wxml vendored Normal file
View File

@ -0,0 +1,15 @@
<view
class="van-rate custom-class"
bind:touchmove="onTouchMove"
>
<van-icon
wx:for="{{ list }}"
wx:key="index"
class="van-rate__item"
size="{{ size }}px"
data-index="{{ index }}"
name="{{ item ? 'star' : 'star-o' }}"
color="{{ disabled ? disabledColor : item ? color : voidColor }}"
bind:click="onSelect"
/>
</view>

1
dist/rate/index.wxss vendored Normal file
View File

@ -0,0 +1 @@
@import '../common/index.wxss';.van-rate{-webkit-user-select:none;user-select:none}.van-rate__item{width:1em;padding:0 2px;box-sizing:content-box}

View File

@ -1,7 +1,7 @@
import { VantComponent } from '../common/component';
VantComponent({
field: true,
classes: ['cancel-class'],
classes: ['field-class', 'input-class', 'cancel-class'],
props: {
focus: Boolean,
error: Boolean,
@ -43,6 +43,9 @@ VantComponent({
},
onBlur: function onBlur() {
this.$emit('blur');
},
onClear: function onClear() {
this.$emit('clear');
}
}
});

View File

@ -10,12 +10,13 @@
error="{{ error }}"
border="{{ false }}"
confirm-type="search"
class="van-search__field"
class="van-search__field field-class"
value="{{ value }}"
disabled="{{ disabled }}"
readonly="{{ readony }}"
maxlength="{{ maxlength }}"
input-align="{{ inputAlign }}"
input-class="input-class"
placeholder="{{ placeholder }}"
placeholder-style="{{ placeholderStyle }}"
custom-style="padding: 3px 10px"
@ -23,6 +24,7 @@
bind:focus="onFocus"
bind:change="onChange"
bind:confirm="onSearch"
bind:clear="onClear"
/>
<view wx:if="{{ showAction || useActionSlot }}" class="van-search__action">
<slot wx:if="{{ useActionSlot }}" name="action" />

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-search{display:-webkit-flex;display:flex;padding:7px 15px;-webkit-align-items:center;align-items:center;box-sizing:border-box}.van-search__field{-webkit-flex:1;flex:1;border-radius:4px}.van-search__field__left-icon{color:#999}.van-search--show-action{padding-right:0}.van-search input::-webkit-search-cancel-button,.van-search input::-webkit-search-decoration,.van-search input::-webkit-search-results-button,.van-search input::-webkit-search-results-decoration{display:none}.van-search__action{padding:0 10px;font-size:14px;line-height:30px;color:#666}.van-search__action:active{background-color:#e8e8e8}
@import '../common/index.wxss';.van-search{display:-webkit-flex;display:flex;padding:7px 15px;-webkit-align-items:center;align-items:center;box-sizing:border-box}.van-search__field{overflow:hidden;border-radius:4px;-webkit-flex:1;flex:1}.van-search__field__left-icon{color:#999}.van-search--show-action{padding-right:0}.van-search input::-webkit-search-cancel-button,.van-search input::-webkit-search-decoration,.van-search input::-webkit-search-results-button,.van-search input::-webkit-search-results-decoration{display:none}.van-search__action{padding:0 10px;font-size:14px;line-height:30px;color:#7d7e80}.van-search__action:active{background-color:#e8e8e8}

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__input,.van-stepper__minus,.van-stepper__plus{display:inline-block;vertical-align:middle;background-color:#fff}.van-stepper__minus,.van-stepper__plus{width:40px;height:30px;box-sizing:border-box;border:1px solid #eee;position:relative;padding:5px}.van-stepper__minus::before,.van-stepper__plus::before{width:9px;height:1px}.van-stepper__minus::after,.van-stepper__plus::after{width:1px;height:9px}.van-stepper__minus::after,.van-stepper__minus::before,.van-stepper__plus::after,.van-stepper__plus::before{content:'';position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;background-color:#666}.van-stepper__minus:active,.van-stepper__plus:active{background-color:#e8e8e8}.van-stepper__minus--disabled,.van-stepper__plus--disabled{background-color:#f8f8f8}.van-stepper__minus--disabled::after,.van-stepper__minus--disabled::before,.van-stepper__plus--disabled::after,.van-stepper__plus--disabled::before{background-color:#c9c9c9}.van-stepper__minus--disabled:active,.van-stepper__plus--disabled:active{background-color:#f8f8f8}.van-stepper__minus{border-radius:2px 0 0 2px}.van-stepper__minus::after{display:none}.van-stepper__plus{border-radius:0 2px 2px 0}.van-stepper__input{width:33px;height:26px;padding:1px;min-height:0;border:1px solid #eee;border-width:1px 0;border-radius:0;box-sizing:content-box;color:#666;font-size:14px;text-align:center;-webkit-appearance:none}.van-stepper__input--disabled{color:#c9c9c9;background-color:#f8f8f8}
@import '../common/index.wxss';.van-stepper{font-size:0}.van-stepper__input,.van-stepper__minus,.van-stepper__plus{display:inline-block;vertical-align:middle;background-color:#fff}.van-stepper__minus,.van-stepper__plus{width:40px;height:30px;box-sizing:border-box;border:1px solid #eee;position:relative;padding:5px}.van-stepper__minus::before,.van-stepper__plus::before{width:9px;height:1px}.van-stepper__minus::after,.van-stepper__plus::after{width:1px;height:9px}.van-stepper__minus::after,.van-stepper__minus::before,.van-stepper__plus::after,.van-stepper__plus::before{content:'';position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;background-color:#7d7e80}.van-stepper__minus:active,.van-stepper__plus:active{background-color:#e8e8e8}.van-stepper__minus--disabled,.van-stepper__plus--disabled{background-color:#f8f8f8}.van-stepper__minus--disabled::after,.van-stepper__minus--disabled::before,.van-stepper__plus--disabled::after,.van-stepper__plus--disabled::before{background-color:#c9c9c9}.van-stepper__minus--disabled:active,.van-stepper__plus--disabled:active{background-color:#f8f8f8}.van-stepper__minus{border-radius:2px 0 0 2px}.van-stepper__minus::after{display:none}.van-stepper__plus{border-radius:0 2px 2px 0}.van-stepper__input{width:33px;height:26px;padding:1px;min-height:0;border:1px solid #eee;border-width:1px 0;border-radius:0;box-sizing:content-box;color:#7d7e80;font-size:14px;text-align:center;-webkit-appearance:none}.van-stepper__input--disabled{color:#c9c9c9;background-color:#f8f8f8}

View File

@ -24,7 +24,9 @@ VantComponent({
var _this$data = this.data,
offset = _this$data.offset,
draging = _this$data.draging;
return "\n transform: translate3d(" + offset + "px, 0, 0);\n transition: " + (draging ? 'none' : '.6s cubic-bezier(0.18, 0.89, 0.32, 1)') + ";\n ";
var transform = "translate3d(" + offset + "px, 0, 0)";
var transition = draging ? 'none' : '.6s cubic-bezier(0.18, 0.89, 0.32, 1)';
return "\n -webkit-transform: " + transform + ";\n -webkit-transition: " + transition + ";\n transform: " + transform + ";\n transition: " + transition + ";\n ";
}
},
methods: {

13
dist/tab/index.js vendored
View File

@ -13,14 +13,11 @@ VantComponent({
active: false
},
watch: {
disabled: function disabled() {
var parent = this.getRelationNodes('../tabs/index')[0];
if (parent) {
parent.updateTabs();
}
},
title: function title() {
title: 'update',
disabled: 'update'
},
methods: {
update: function update() {
var parent = this.getRelationNodes('../tabs/index')[0];
if (parent) {

View File

@ -1 +1 @@
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-tabbar-item{color:#666;height:100%;display:-webkit-flex;display:flex;line-height:1;font-size:12px;-webkit-align-items:center;align-items:center;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}.van-tabbar-item__icon{font-size:18px;margin-bottom:5px;position:relative}.van-tabbar-item__icon .van-icon{display:block}.van-tabbar-item__icon .van-icon__info{color:#fff;left:100%;top:-.5em;font-size:.6em;padding:0 .25em;text-align:center;min-width:1.4em;line-height:1.4;position:absolute;border-radius:.6em;box-sizing:border-box;background-color:#f44;-webkit-transform:translateX(-50%);transform:translateX(-50%);font-family:PingFang SC,Helvetica Neue,Arial,sans-serif}.van-tabbar-item__icon--dot::after{top:0;right:-8px;width:8px;height:8px;content:' ';position:absolute;border-radius:100%;background-color:#f44}.van-tabbar-item__icon image{width:50px;height:18px}.van-tabbar-item--active{color:#1989fa}
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-tabbar-item{color:#7d7e80;height:100%;display:-webkit-flex;display:flex;line-height:1;font-size:12px;-webkit-align-items:center;align-items:center;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center}.van-tabbar-item__icon{font-size:18px;margin-bottom:5px;position:relative}.van-tabbar-item__icon .van-icon{display:block}.van-tabbar-item__icon .van-icon__info{color:#fff;left:100%;top:-.5em;font-size:.6em;padding:0 .25em;text-align:center;min-width:1.4em;line-height:1.4;position:absolute;border-radius:.6em;box-sizing:border-box;background-color:#f44;-webkit-transform:translateX(-50%);transform:translateX(-50%);font-family:PingFang SC,Helvetica Neue,Arial,sans-serif}.van-tabbar-item__icon--dot::after{top:0;right:-8px;width:8px;height:8px;content:' ';position:absolute;border-radius:100%;background-color:#f44}.van-tabbar-item__icon image{width:50px;height:18px}.van-tabbar-item--active{color:#1989fa}

57
dist/tabs/index.js vendored
View File

@ -4,26 +4,23 @@ VantComponent({
name: 'tab',
type: 'descendant',
linked: function linked(child) {
this.data.tabs.push({
instance: child,
data: child.data
});
this.updateTabs();
this.child.push(child);
this.updateTabs(this.data.tabs.concat(child.data));
},
unlinked: function unlinked(child) {
var tabs = this.data.tabs.filter(function (item) {
return item.instance !== child;
});
this.setData({
tabs: tabs,
scrollable: tabs.length > this.data.swipeThreshold
});
this.setActiveTab();
var index = this.child.indexOf(child);
var tabs = this.data.tabs;
tabs.splice(index, 1);
this.child.splice(index, 1);
this.updateTabs(tabs);
}
},
props: {
color: String,
lineWidth: Number,
lineWidth: {
type: Number,
value: -1
},
active: {
type: Number,
value: 0
@ -58,20 +55,23 @@ VantComponent({
watch: {
swipeThreshold: function swipeThreshold() {
this.setData({
scrollable: this.data.tabs.length > this.data.swipeThreshold
scrollable: this.child.length > this.data.swipeThreshold
});
},
color: 'setLine',
lineWidth: 'setLine',
active: 'setActiveTab'
},
beforeCreate: function beforeCreate() {
this.child = [];
},
mounted: function mounted() {
this.setLine();
this.scrollIntoView();
},
methods: {
updateTabs: function updateTabs() {
var tabs = this.data.tabs;
updateTabs: function updateTabs(tabs) {
tabs = tabs || this.data.tabs;
this.setData({
tabs: tabs,
scrollable: tabs.length > this.data.swipeThreshold
@ -81,13 +81,13 @@ VantComponent({
trigger: function trigger(eventName, index) {
this.$emit(eventName, {
index: index,
title: this.data.tabs[index].data.title
title: this.data.tabs[index].title
});
},
onTap: function onTap(event) {
var index = event.currentTarget.dataset.index;
if (this.data.tabs[index].data.disabled) {
if (this.data.tabs[index].disabled) {
this.trigger('disabled', index);
} else {
this.trigger('click', index);
@ -110,23 +110,28 @@ VantComponent({
return;
}
var _this$data = this.data,
color = _this$data.color,
active = _this$data.active,
duration = _this$data.duration,
lineWidth = _this$data.lineWidth;
this.getRect('.van-tab', true).then(function (rects) {
var rect = rects[_this.data.active];
var width = _this.data.lineWidth || rect.width / 2;
var left = rects.slice(0, _this.data.active).reduce(function (prev, curr) {
var rect = rects[active];
var width = lineWidth !== -1 ? lineWidth : rect.width / 2;
var left = rects.slice(0, active).reduce(function (prev, curr) {
return prev + curr.width;
}, 0);
left += (rect.width - width) / 2;
_this.setData({
lineStyle: "\n width: " + width + "px;\n background-color: " + _this.data.color + ";\n transform: translateX(" + left + "px);\n transition-duration: " + _this.data.duration + "s;\n "
lineStyle: "\n width: " + width + "px;\n background-color: " + color + ";\n -webkit-transform: translateX(" + left + "px);\n -webkit-transition-duration: " + duration + "s;\n transform: translateX(" + left + "px);\n transition-duration: " + duration + "s;\n "
});
});
},
setActiveTab: function setActiveTab() {
var _this2 = this;
this.data.tabs.forEach(function (item, index) {
this.child.forEach(function (item, index) {
var data = {
active: index === _this2.data.active
};
@ -135,8 +140,8 @@ VantComponent({
data.inited = true;
}
if (data.active !== item.instance.data.active) {
item.instance.setData(data);
if (data.active !== item.data.active) {
item.setData(data);
}
});
this.setData({}, function () {

View File

@ -13,11 +13,11 @@
wx:for="{{ tabs }}"
wx:key="index"
data-index="{{ index }}"
class="van-ellipsis van-tab {{ index === active ? 'van-tab--active' : '' }} {{ item.data.disabled ? 'van-tab--disabled' : '' }}"
style="{{ color && (index === active) !== (type === 'card') && !item.data.disabled ? 'color: ' + color : '' }} {{ color && index === active && type === 'card' ? ';background-color:' + color : '' }} {{ color ? ';border-color: ' + color : '' }}"
class="van-ellipsis van-tab {{ index === active ? 'van-tab--active' : '' }} {{ item.disabled ? 'van-tab--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) + '%' : '' }}"
bind:tap="onTap"
>
{{ item.data.title }}
{{ item.title }}
</view>
</view>
</scroll-view>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{top:0;left:0;right:0;position:absolute}.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:1px solid #f44;border-radius:2px}.van-tabs__nav{display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none;position:relative;background-color:#fff}.van-tabs__nav--line{height:100%}.van-tabs__nav--card{height:30px}.van-tabs__nav--card .van-tab{color:#f44;border-right:1px solid #f44;line-height:30px}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;background-color:#f44}.van-tabs__line{z-index:1;left:0;bottom:0;height:2px;position:absolute;background-color:#f44;border-radius:2px 0 2px 0}.van-tabs--line{padding-top:44px}.van-tabs--line .van-tabs__wrap{height:44px}.van-tabs--card{padding-top:30px;margin:0 15px}.van-tabs--card .van-tabs__wrap{height:30px}.van-tab{-webkit-flex:1;flex:1;cursor:pointer;padding:0 5px;font-size:14px;position:relative;color:#333;line-height:44px;text-align:center;box-sizing:border-box;background-color:#fff;min-width:0}.van-tab span{display:block}.van-tab--active{color:#f44}.van-tab--disabled{color:#c9c9c9}
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{top:0;left:0;right:0;position:absolute}.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:1px solid #f44;border-radius:2px}.van-tabs__nav{display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none;position:relative;background-color:#fff}.van-tabs__nav--line{height:100%}.van-tabs__nav--card{height:30px}.van-tabs__nav--card .van-tab{color:#f44;border-right:1px solid #f44;line-height:30px}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;background-color:#f44}.van-tabs__line{z-index:1;left:0;bottom:0;height:2px;position:absolute;background-color:#f44;border-radius:2px}.van-tabs--line{padding-top:44px}.van-tabs--line .van-tabs__wrap{height:44px}.van-tabs--card{padding-top:30px;margin:0 15px}.van-tabs--card .van-tabs__wrap{height:30px}.van-tab{-webkit-flex:1;flex:1;cursor:pointer;padding:0 5px;font-size:14px;position:relative;color:#7d7e80;line-height:44px;text-align:center;box-sizing:border-box;background-color:#fff;min-width:0}.van-tab span{display:block}.van-tab--active{font-weight:500;color:#333}.van-tab--disabled{color:#c9c9c9}

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;color:#fff;font-size:12px;line-height:1.2;border-radius:5px;word-break:break-all;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;-webkit-flex-direction:column;flex-direction:column;box-sizing:border-box;background-color:rgba(0,0,0,.7)}.van-toast__container{top:50%;left:50%;position:fixed;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-toast--text{padding:12px;min-width:220px}.van-toast--icon{width:120px;min-height:120px;padding:15px}.van-toast--icon .van-toast__icon{height:1em;font-size:50px}.van-toast--icon .van-toast__text{font-size:14px;padding-top:10px}.van-toast__loading{margin:10px 0 5px}.van-toast--top{-webkit-transform:translate(0,-30vh);transform:translate(0,-30vh)}.van-toast--bottom{-webkit-transform:translate(0,30vh);transform:translate(0,30vh)}
@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;color:#fff;font-size:14px;line-height:20px;border-radius:4px;word-break:break-all;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;-webkit-flex-direction:column;flex-direction:column;box-sizing:border-box;background-color:rgba(0,0,0,.7)}.van-toast__container{top:50%;left:50%;max-width:80%;position:fixed;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.van-toast--text{min-width:120px;padding:8px 12px}.van-toast--icon{width:120px;min-height:120px;padding:15px}.van-toast--icon .van-toast__icon{height:1em;font-size:50px}.van-toast--icon .van-toast__text{font-size:14px;padding-top:10px}.van-toast__loading{margin:10px 0 5px}.van-toast--top{-webkit-transform:translate(0,-30vh);transform:translate(0,-30vh)}.van-toast--bottom{-webkit-transform:translate(0,30vh);transform:translate(0,30vh)}

View File

@ -35,7 +35,11 @@ VantComponent({
methods: {
// 当一个子项被选择时
onSelectItem: function onSelectItem(event) {
this.$emit('click-item', event.currentTarget.dataset.item);
var item = event.currentTarget.dataset.item;
if (!item.disabled) {
this.$emit('click-item', item);
}
},
// 当一个导航被点击时
onClickNav: function onClickNav(event) {

View File

@ -21,7 +21,7 @@
<view
wx:for="{{ subItems }}"
wx:key="item.id"
class="van-tree-select__item van-ellipsis {{ activeId === item.id ? 'van-tree-select__item--active' : '' }}"
class="van-tree-select__item van-ellipsis {{ activeId === item.id ? 'van-tree-select__item--active' : '' }} {{ item.disabled ? 'van-tree-select__item--disabled' : '' }}"
data-item="{{ item }}"
bind:tap="onSelectItem"
>

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-tree-select{-webkit-user-select:none;user-select:none;position:relative;font-size:16px}.van-tree-select__nav{width:35%;position:absolute;left:0;top:0;bottom:0;background-color:#fff}.van-tree-select__nitem{line-height:44px;padding:0 15px;background-color:#fff}.van-tree-select__nitem--active,.van-tree-select__nitem:active{background-color:#f8f8f8}.van-tree-select__nitem--active{font-weight:500}.van-tree-select__content{width:65%;padding:0 15px;margin-left:35%;box-sizing:border-box}.van-tree-select__item{position:relative;line-height:44px;padding-left:5px;padding-right:18px}.van-tree-select__item--active,.van-tree-select__item:active{color:#f44}.van-tree-select__selected{float:right;position:absolute;right:0;top:0;bottom:0;line-height:inherit}
@import '../common/index.wxss';.van-tree-select{-webkit-user-select:none;user-select:none;position:relative;font-size:16px}.van-tree-select__nav{width:35%;position:absolute;left:0;top:0;bottom:0;background-color:#fff}.van-tree-select__nitem{line-height:44px;padding:0 15px;background-color:#fff}.van-tree-select__nitem--active,.van-tree-select__nitem:active{background-color:#f8f8f8}.van-tree-select__nitem--active{font-weight:500}.van-tree-select__content{width:65%;padding:0 15px;margin-left:35%;box-sizing:border-box}.van-tree-select__item{position:relative;line-height:44px;padding-left:5px;padding-right:18px}.van-tree-select__item--active,.van-tree-select__item:active{color:#f44}.van-tree-select__item--disabled,.van-tree-select__item--disabled:active{color:#c9c9c9}.van-tree-select__selected{float:right;position:absolute;right:0;top:0;bottom:0;line-height:inherit}