build: compile 1.0.1

This commit is contained in:
rex-zsd 2019-12-23 14:09:31 +08:00
parent 1a22587e4f
commit 96fc84cbd1
70 changed files with 246 additions and 357 deletions

View File

@ -1,5 +1,4 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { addUnit } from '../common/utils';
function emit(target, value) { function emit(target, value) {
target.$emit('input', value); target.$emit('input', value);
target.$emit('change', value); target.$emit('change', value);
@ -30,12 +29,9 @@ VantComponent({
}, },
iconSize: { iconSize: {
type: null, type: null,
observer: 'setSizeWithUnit' value: 20
} }
}, },
data: {
sizeWithUnit: '20px'
},
methods: { methods: {
emitChange(value) { emitChange(value) {
if (this.parent) { if (this.parent) {
@ -77,11 +73,6 @@ VantComponent({
emit(parent, parentValue); emit(parent, parentValue);
} }
} }
}, }
setSizeWithUnit(size) {
this.set({
sizeWithUnit: addUnit(size)
});
},
} }
}); });

View File

@ -8,7 +8,7 @@
name="success" name="success"
size="0.8em" size="0.8em"
class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}" class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
style="font-size: {{ sizeWithUnit }};{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}" style="font-size: {{ utils.addUnit(iconSize) }};{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}"
custom-class="icon-class" custom-class="icon-class"
custom-style="line-height: 1.25em;" custom-style="line-height: 1.25em;"
/> />

View File

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

11
dist/dialog/index.js vendored
View File

@ -1,7 +1,6 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { button } from '../mixins/button'; import { button } from '../mixins/button';
import { openType } from '../mixins/open-type'; import { openType } from '../mixins/open-type';
import { addUnit } from '../common/utils';
import { GRAY, BLUE } from '../common/color'; import { GRAY, BLUE } from '../common/color';
VantComponent({ VantComponent({
mixins: [button, openType], mixins: [button, openType],
@ -19,10 +18,7 @@ VantComponent({
showCancelButton: Boolean, showCancelButton: Boolean,
closeOnClickOverlay: Boolean, closeOnClickOverlay: Boolean,
confirmButtonOpenType: String, confirmButtonOpenType: String,
width: { width: null,
type: null,
observer: 'setWidthWithUnit'
},
zIndex: { zIndex: {
type: Number, type: Number,
value: 2000 value: 2000
@ -109,11 +105,6 @@ VantComponent({
if (callback) { if (callback) {
callback(this); callback(this);
} }
},
setWidthWithUnit(val) {
this.setData({
widthWithUnit: addUnit(val)
});
} }
} }
}); });

View File

@ -1,10 +1,12 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<van-popup <van-popup
show="{{ show }}" show="{{ show }}"
z-index="{{ zIndex }}" z-index="{{ zIndex }}"
overlay="{{ overlay }}" overlay="{{ overlay }}"
transition="{{ transition }}" transition="{{ transition }}"
custom-class="van-dialog {{ className }}" custom-class="van-dialog {{ className }}"
custom-style="{{ widthWithUnit ? 'width: ' + widthWithUnit + ';' : '' }}{{ customStyle }}" custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
overlay-style="{{ overlayStyle }}" overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}" close-on-click-overlay="{{ closeOnClickOverlay }}"
bind:close="onClickOverlay" bind:close="onClickOverlay"

View File

@ -16,6 +16,7 @@ VantComponent({
color: String, color: String,
loading: Boolean, loading: Boolean,
disabled: Boolean, disabled: Boolean,
plain: Boolean,
type: { type: {
type: String, type: String,
value: 'danger' value: 'danger'
@ -31,10 +32,16 @@ VantComponent({
}, },
updateStyle() { updateStyle() {
const { children = [] } = this.parent; const { children = [] } = this.parent;
const { length } = children;
const index = children.indexOf(this); const index = children.indexOf(this);
let rightBorderLess = false;
if (length > 1) {
rightBorderLess = index !== length - 1;
}
this.setData({ this.setData({
isFirst: index === 0, isFirst: index === 0,
isLast: index === children.length - 1 rightBorderLess,
isLast: index === length - 1
}); });
} }
} }

View File

@ -5,10 +5,11 @@
lang="{{ lang }}" lang="{{ lang }}"
type="{{ type }}" type="{{ type }}"
color="{{ color }}" color="{{ color }}"
plain="{{ plain }}"
loading="{{ loading }}" loading="{{ loading }}"
disabled="{{ disabled }}" disabled="{{ disabled }}"
open-type="{{ openType }}" open-type="{{ openType }}"
custom-class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast }]) }}" custom-class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain : plain, ordinary: !plain }])}} {{ rightBorderLess ?'van-goods-action-button--no-right-border': ''}}"
business-id="{{ businessId }}" business-id="{{ businessId }}"
session-from="{{ sessionFrom }}" session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}" app-parameter="{{ appParameter }}"

View File

@ -1 +1 @@
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{border:none!important;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))}@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{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}}

14
dist/icon/index.js vendored
View File

@ -1,13 +1,9 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { addUnit } from '../common/utils';
VantComponent({ VantComponent({
props: { props: {
dot: Boolean, dot: Boolean,
info: null, info: null,
size: { size: null,
type: null,
observer: 'setSizeWithUnit'
},
color: String, color: String,
customStyle: String, customStyle: String,
classPrefix: { classPrefix: {
@ -23,17 +19,9 @@ VantComponent({
} }
} }
}, },
data: {
sizeWithUnit: null,
},
methods: { methods: {
onClick() { onClick() {
this.$emit('click'); this.$emit('click');
},
setSizeWithUnit(size) {
this.setData({
sizeWithUnit: addUnit(size)
});
} }
} }
}); });

View File

@ -1,6 +1,8 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view <view
class="custom-class {{ classPrefix }} {{ isImageName ? 'van-icon--image' : classPrefix + '-' + name }}" class="custom-class {{ classPrefix }} {{ isImageName ? 'van-icon--image' : classPrefix + '-' + name }}"
style="{{ color ? 'color: ' + color + ';' : '' }}{{ size ? 'font-size: ' + sizeWithUnit + ';' : '' }}{{ customStyle }}" style="color: {{ color }};font-size: {{ utils.addUnit(size) }};{{ customStyle }}"
bind:tap="onClick" bind:tap="onClick"
> >
<van-info <van-info

File diff suppressed because one or more lines are too long

23
dist/loading/index.js vendored
View File

@ -1,5 +1,4 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { addUnit } from '../common/utils';
VantComponent({ VantComponent({
props: { props: {
color: String, color: String,
@ -8,25 +7,7 @@ VantComponent({
type: String, type: String,
value: 'circular' value: 'circular'
}, },
size: { size: String,
type: String, textSize: String
observer: 'setSizeWithUnit'
},
textSize: {
type: String,
observer: 'setTextSizeWithUnit'
}
},
methods: {
setSizeWithUnit(size) {
this.setData({
sizeWithUnit: addUnit(size)
});
},
setTextSizeWithUnit(size) {
this.set({
textSizeWithUnit: addUnit(size)
});
}
} }
}); });

View File

@ -1,7 +1,9 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="custom-class van-loading {{ vertical ? 'van-loading--vertical' : '' }}"> <view class="custom-class van-loading {{ vertical ? 'van-loading--vertical' : '' }}">
<view <view
class="van-loading__spinner van-loading__spinner--{{ type }}" class="van-loading__spinner van-loading__spinner--{{ type }}"
style="color: {{ color }}; width: {{ sizeWithUnit }}; height: {{ sizeWithUnit }}" style="color: {{ color }}; width: {{ utils.addUnit(size) }}; height: {{ utils.addUnit(size) }}"
> >
<view <view
wx:if="{{ type === 'spinner' }}" wx:if="{{ type === 'spinner' }}"
@ -10,7 +12,7 @@
class="van-loading__dot" class="van-loading__dot"
/> />
</view> </view>
<view class="van-loading__text" style="font-size: {{ textSizeWithUnit }};"> <view class="van-loading__text" style="font-size: {{ utils.addUnit(textSize) }};">
<slot /> <slot />
</view> </view>
</view> </view>

View File

@ -1,14 +1,8 @@
export const behavior = Behavior({ export const behavior = Behavior({
methods: { methods: {
set(data, callback) { set(data, callback) {
return new Promise(resolve => { this.setData(data, callback);
this.setData(data, () => { return new Promise(resolve => wx.nextTick(resolve));
if (callback && typeof callback === 'function') {
callback.call(this);
}
resolve();
});
});
} }
} }
}); });

View File

@ -51,6 +51,9 @@ VantComponent({
watch: { watch: {
text() { text() {
this.setData({}, this.init); this.setData({}, this.init);
},
speed() {
this.setData({}, this.init);
} }
}, },
created() { created() {

10
dist/notify/index.js vendored
View File

@ -33,9 +33,8 @@ VantComponent({
show() { show() {
const { duration, onOpened } = this.data; const { duration, onOpened } = this.data;
clearTimeout(this.timer); clearTimeout(this.timer);
this.setData({ this.setData({ show: true });
show: true wx.nextTick(onOpened);
}, onOpened);
if (duration > 0 && duration !== Infinity) { if (duration > 0 && duration !== Infinity) {
this.timer = setTimeout(() => { this.timer = setTimeout(() => {
this.hide(); this.hide();
@ -45,9 +44,8 @@ VantComponent({
hide() { hide() {
const { onClose } = this.data; const { onClose } = this.data;
clearTimeout(this.timer); clearTimeout(this.timer);
this.setData({ this.setData({ show: false });
show: false wx.nextTick(onClose);
}, onClose);
}, },
onTap(event) { onTap(event) {
const { onClick } = this.data; const { onClick } = this.data;

View File

@ -9,7 +9,10 @@
class="van-notify van-notify--{{ type }}" class="van-notify van-notify--{{ type }}"
style="background:{{ background }};color:{{ color }};" style="background:{{ background }};color:{{ color }};"
> >
<view wx:if="{{ safeAreaInsetTop }}" class="van-notify__safe-area"></view> <view
wx:if="{{ safeAreaInsetTop }}"
style="height: {{ statusBarHeight }}px"
></view>
<text>{{ message }}</text> <text>{{ message }}</text>
</view> </view>
</van-transition> </van-transition>

View File

@ -7,6 +7,7 @@ const defaultOptions = {
duration: 3000, duration: 3000,
zIndex: 110, zIndex: 110,
color: WHITE, color: WHITE,
safeAreaInsetTop: false,
onClick: () => { }, onClick: () => { },
onOpened: () => { }, onOpened: () => { },
onClose: () => { } onClose: () => { }
@ -25,7 +26,7 @@ export default function Notify(options) {
delete options.context; delete options.context;
delete options.selector; delete options.selector;
if (notify) { if (notify) {
notify.set(options); notify.setData(options);
notify.show(); notify.show();
return notify; return notify;
} }

View File

@ -1,6 +1,5 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { BLUE } from '../common/color'; import { BLUE } from '../common/color';
import { addUnit } from '../common/utils';
VantComponent({ VantComponent({
props: { props: {
inactive: Boolean, inactive: Boolean,
@ -22,17 +21,7 @@ VantComponent({
}, },
strokeWidth: { strokeWidth: {
type: null, type: null,
observer: 'setStrokeWidthUnit' value: 4
}
},
data: {
strokeWidthUnit: '4px'
},
methods: {
setStrokeWidthUnit(val) {
this.setData({
strokeWidthUnit: addUnit(val)
});
} }
} }
}); });

View File

@ -1,8 +1,9 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="getters" /> <wxs src="./index.wxs" module="getters" />
<view <view
class="van-progress custom-class" class="van-progress custom-class"
style="height: {{ strokeWidthUnit }}; {{ trackColor ? 'background: ' + trackColor : '' }}" style="height: {{ utils.addUnit(strokeWidth) }}; {{ trackColor ? 'background: ' + trackColor : '' }}"
> >
<view <view
class="van-progress__portion" class="van-progress__portion"

11
dist/radio/index.js vendored
View File

@ -1,5 +1,4 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { addUnit } from '../common/utils';
VantComponent({ VantComponent({
field: true, field: true,
relation: { relation: {
@ -29,18 +28,10 @@ VantComponent({
}, },
iconSize: { iconSize: {
type: null, type: null,
observer: 'setIconSizeUnit' value: 20
} }
}, },
data: {
iconSizeWithUnit: '20px'
},
methods: { methods: {
setIconSizeUnit(val) {
this.setData({
iconSizeWithUnit: addUnit(val)
});
},
emitChange(value) { emitChange(value) {
const instance = this.parent || this; const instance = this.parent || this;
instance.$emit('input', value); instance.$emit('input', value);

View File

@ -8,15 +8,15 @@
> >
<slot /> <slot />
</view> </view>
<view class="van-radio__icon-wrap" style="font-size: {{ iconSizeWithUnit }};" bindtap="onChange"> <view class="van-radio__icon-wrap" style="font-size: {{ utils.addUnit(iconSize) }};" bindtap="onChange">
<slot wx:if="{{ useIconSlot }}" name="icon" /> <slot wx:if="{{ useIconSlot }}" name="icon" />
<van-icon <van-icon
wx:else wx:else
name="success" name="success"
class="{{ utils.bem('radio__icon', [shape, { disabled, checked: value === name }]) }}" class="{{ utils.bem('radio__icon', [shape, { disabled, checked: value === name }]) }}"
style="{{ checkedColor && !disabled && value === name ? 'border-color:' + checkedColor + '; background-color:' + checkedColor + ';' : '' }}" style="font-size: {{ utils.addUnit(iconSize) }};{{ checkedColor && !disabled && value === name ? 'border-color:' + checkedColor + '; background-color:' + checkedColor + ';' : '' }}"
custom-class="icon-class" custom-class="icon-class"
custom-style="line-height: {{ iconSizeWithUnit }};font-size: .8em;display: block;" custom-style="line-height: {{ utils.addUnit(iconSize) }};font-size: .8em;display: block;"
/> />
</view> </view>
<view <view

View File

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

41
dist/rate/index.js vendored
View File

@ -1,17 +1,20 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { addUnit } from '../common/utils';
VantComponent({ VantComponent({
field: true, field: true,
classes: ['icon-class'], classes: ['icon-class'],
props: { props: {
value: Number, value: {
type: Number,
observer(value) {
if (value !== this.data.innerValue) {
this.setData({ innerValue: value });
}
}
},
readonly: Boolean, readonly: Boolean,
disabled: Boolean, disabled: Boolean,
allowHalf: Boolean, allowHalf: Boolean,
size: { size: null,
type: null,
observer: 'setSizeWithUnit'
},
icon: { icon: {
type: String, type: String,
value: 'star' value: 'star'
@ -36,38 +39,16 @@ VantComponent({
type: Number, type: Number,
value: 5 value: 5
}, },
gutter: { gutter: null,
type: null,
observer: 'setGutterWithUnit'
},
touchable: { touchable: {
type: Boolean, type: Boolean,
value: true value: true
} }
}, },
data: { data: {
innerValue: 0, innerValue: 0
gutterWithUnit: undefined,
sizeWithUnit: null
},
watch: {
value(value) {
if (value !== this.data.innerValue) {
this.setData({ innerValue: value });
}
}
}, },
methods: { methods: {
setGutterWithUnit(val) {
this.setData({
gutterWithUnit: addUnit(val)
});
},
setSizeWithUnit(size) {
this.setData({
sizeWithUnit: addUnit(size)
});
},
onSelect(event) { onSelect(event) {
const { data } = this; const { data } = this;
const { score } = event.currentTarget.dataset; const { score } = event.currentTarget.dataset;

View File

@ -8,12 +8,12 @@
class="van-rate__item" class="van-rate__item"
wx:for="{{ count }}" wx:for="{{ count }}"
wx:key="index" wx:key="index"
style="padding-right: {{ index !== count - 1 ? gutterWithUnit : '' }}" style="padding-right: {{ index !== count - 1 ? utils.addUnit(gutter) : '' }}"
> >
<van-icon <van-icon
name="{{ index + 1 <= innerValue ? icon : voidIcon }}" name="{{ index + 1 <= innerValue ? icon : voidIcon }}"
class="van-rate__icon" class="van-rate__icon"
style="font-size :{{ size? sizeWithUnit : ''}}" style="font-size: {{ utils.addUnit(size) }}"
custom-class="icon-class" custom-class="icon-class"
data-score="{{ index }}" data-score="{{ index }}"
color="{{ disabled ? disabledColor : index + 1 <= innerValue ? color : voidColor }}" color="{{ disabled ? disabledColor : index + 1 <= innerValue ? color : voidColor }}"
@ -24,7 +24,7 @@
wx:if="{{ allowHalf }}" wx:if="{{ allowHalf }}"
name="{{ index + 0.5 <= innerValue ? icon : voidIcon }}" name="{{ index + 0.5 <= innerValue ? icon : voidIcon }}"
class="{{ utils.bem('rate__icon', ['half']) }}" class="{{ utils.bem('rate__icon', ['half']) }}"
style="font-size :{{ size? sizeWithUnit : ''}}" style="font-size: {{ utils.addUnit(size) }}"
custom-class="icon-class" custom-class="icon-class"
data-score="{{ index - 0.5 }}" data-score="{{ index - 0.5 }}"
color="{{ disabled ? disabledColor : index + 0.5 <= innerValue ? color : voidColor }}" color="{{ disabled ? disabledColor : index + 0.5 <= innerValue ? color : voidColor }}"

6
dist/steps/index.js vendored
View File

@ -1,5 +1,5 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { GREEN } from '../common/color'; import { GREEN, GRAY_DARK } from '../common/color';
VantComponent({ VantComponent({
props: { props: {
icon: String, icon: String,
@ -13,6 +13,10 @@ VantComponent({
type: String, type: String,
value: GREEN value: GREEN
}, },
inactiveColor: {
type: String,
value: GRAY_DARK
},
activeIcon: { activeIcon: {
type: String, type: String,
value: 'checked' value: 'checked'

View File

@ -6,6 +6,7 @@
wx:for="{{ steps }}" wx:for="{{ steps }}"
wx:key="index" wx:key="index"
class="{{ utils.bem('step', [direction, status(index, active)]) }} van-hairline" class="{{ utils.bem('step', [direction, status(index, active)]) }} van-hairline"
style="{{ status(index, active) === 'inactive' ? 'color: ' + inactiveColor: '' }}"
> >
<view class="van-step__title" style="{{ index === active ? 'color: ' + activeColor : '' }}"> <view class="van-step__title" style="{{ index === active ? 'color: ' + activeColor : '' }}">
<view>{{ item.text }}</view> <view>{{ item.text }}</view>
@ -15,14 +16,14 @@
<block wx:if="{{ index !== active }}"> <block wx:if="{{ index !== active }}">
<van-icon <van-icon
wx:if="{{ inactiveIcon }}" wx:if="{{ inactiveIcon }}"
color="#969799" color="{{ status(index, active) === 'inactive' ? inactiveColor: activeColor }}"
name="{{ inactiveIcon }}" name="{{ inactiveIcon }}"
custom-class="van-step__icon" custom-class="van-step__icon"
/> />
<view <view
wx:else wx:else
class="van-step__circle" class="van-step__circle"
style="{{ index < active ? 'background-color: ' + activeColor : '' }}" style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}"
/> />
</block> </block>
@ -30,7 +31,7 @@
</view> </view>
<view <view
wx:if="{{ index !== steps.length - 1 }}" wx:if="{{ index !== steps.length - 1 }}"
class="van-step__line" style="{{ index < active ? 'background-color: ' + activeColor : '' }}" class="van-step__line" style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}"
/> />
</view> </view>
</view> </view>
@ -44,7 +45,7 @@ function get(index, active) {
return 'process'; return 'process';
} }
return ''; return 'inactive';
} }
module.exports = get; module.exports = get;

5
dist/tag/index.json vendored
View File

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

View File

@ -1,5 +1,4 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { addUnit } from '../common/utils';
VantComponent({ VantComponent({
classes: [ classes: [
'main-item-class', 'main-item-class',
@ -22,8 +21,7 @@ VantComponent({
}, },
height: { height: {
type: [Number, String], type: [Number, String],
value: 300, value: 300
observer: 'updateHeight'
}, },
max: { max: {
type: Number, type: Number,
@ -33,9 +31,6 @@ VantComponent({
data: { data: {
subItems: [] subItems: []
}, },
created() {
this.updateHeight();
},
methods: { methods: {
// 当一个子项被选择时 // 当一个子项被选择时
onSelectItem(event) { onSelectItem(event) {
@ -64,11 +59,6 @@ VantComponent({
const { items, mainActiveIndex } = this.data; const { items, mainActiveIndex } = this.data;
const { children = [] } = items[mainActiveIndex] || {}; const { children = [] } = items[mainActiveIndex] || {};
return this.set({ subItems: children }); return this.set({ subItems: children });
},
updateHeight() {
this.setData({
innerHeight: addUnit(this.data.height)
});
} }
} }
}); });

View File

@ -3,7 +3,7 @@
<view <view
class="van-tree-select" class="van-tree-select"
style="height: {{ innerHeight }}" style="height: {{ utils.addUnit(height) }}"
> >
<scroll-view scroll-y class="van-tree-select__nav"> <scroll-view scroll-y class="van-tree-select__nav">
<van-sidebar active-key="{{ mainActiveIndex }}" bind:change="onClickNav" custom-class="van-tree-select__nav__inner"> <van-sidebar active-key="{{ mainActiveIndex }}" bind:change="onClickNav" custom-class="van-tree-select__nav__inner">

View File

@ -1,17 +1,14 @@
import { VantComponent } from '../common/component'; import { VantComponent } from '../common/component';
import { isImageFile } from './utils'; import { isImageFile } from './utils';
import { addUnit } from '../common/utils';
VantComponent({ VantComponent({
props: { props: {
disabled: Boolean, disabled: Boolean,
multiple: Boolean, multiple: Boolean,
uploadText: String, uploadText: String,
useSlot: Boolean,
useBeforeRead: Boolean, useBeforeRead: Boolean,
previewSize: { previewSize: {
type: null, type: null,
value: 90, value: 90
observer: 'setComputedPreviewSize'
}, },
name: { name: {
type: [Number, String], type: [Number, String],
@ -21,6 +18,14 @@ VantComponent({
type: String, type: String,
value: 'image' value: 'image'
}, },
sizeType: {
type: Array,
value: ['original', 'compressed']
},
capture: {
type: Array,
value: ['album', 'camera']
},
fileList: { fileList: {
type: Array, type: Array,
value: [], value: [],
@ -62,15 +67,10 @@ VantComponent({
const lists = fileList.map(item => (Object.assign(Object.assign({}, item), { isImage: typeof item.isImage === 'undefined' ? isImageFile(item) : item.isImage }))); const lists = fileList.map(item => (Object.assign(Object.assign({}, item), { isImage: typeof item.isImage === 'undefined' ? isImageFile(item) : item.isImage })));
this.setData({ lists, isInCount: lists.length < maxCount }); this.setData({ lists, isInCount: lists.length < maxCount });
}, },
setComputedPreviewSize(val) {
this.setData({
computedPreviewSize: addUnit(val)
});
},
startUpload() { startUpload() {
if (this.data.disabled) if (this.data.disabled)
return; return;
const { name = '', capture = ['album', 'camera'], maxCount = 100, multiple = false, maxSize, accept, lists, useBeforeRead = false // 是否定义了 beforeRead const { name = '', capture, maxCount, multiple, maxSize, accept, sizeType, lists, useBeforeRead = false // 是否定义了 beforeRead
} = this.data; } = this.data;
let chooseFile = null; let chooseFile = null;
const newMaxCount = maxCount - lists.length; const newMaxCount = maxCount - lists.length;
@ -80,6 +80,7 @@ VantComponent({
wx.chooseImage({ wx.chooseImage({
count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1, count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1,
sourceType: capture, sourceType: capture,
sizeType,
success: resolve, success: resolve,
fail: reject fail: reject
}); });
@ -95,7 +96,8 @@ VantComponent({
}); });
}); });
} }
chooseFile.then((res) => { chooseFile
.then((res) => {
const file = multiple ? res.tempFiles : res.tempFiles[0]; const file = multiple ? res.tempFiles : res.tempFiles[0];
// 检查文件大小 // 检查文件大小
if (file instanceof Array) { if (file instanceof Array) {
@ -125,6 +127,9 @@ VantComponent({
else { else {
this.$emit('after-read', { file, name }); this.$emit('after-read', { file, name });
} }
})
.catch(error => {
this.$emit('error', error);
}); });
}, },
deleteItem(event) { deleteItem(event) {

View File

@ -15,14 +15,14 @@
src="{{ item.url || item.path }}" src="{{ item.url || item.path }}"
alt="{{ item.name || ('图片' + index) }}" alt="{{ item.name || ('图片' + index) }}"
class="van-uploader__preview-image" class="van-uploader__preview-image"
style="width: {{ computedPreviewSize }}; height: {{ computedPreviewSize }};" style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
data-url="{{ item.url || item.path }}" data-url="{{ item.url || item.path }}"
bind:tap="doPreviewImage" bind:tap="doPreviewImage"
/> />
<view <view
wx:else wx:else
class="van-uploader__file" class="van-uploader__file"
style="width: {{ computedPreviewSize }}; height: {{ computedPreviewSize }};" style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
> >
<van-icon name="description" class="van-uploader__file-icon" /> <van-icon name="description" class="van-uploader__file-icon" />
<view class="van-uploader__file-name van-ellipsis">{{ item.name || item.url || item.path }}</view> <view class="van-uploader__file-name van-ellipsis">{{ item.name || item.url || item.path }}</view>
@ -38,15 +38,14 @@
<!-- 上传样式 --> <!-- 上传样式 -->
<block wx:if="{{ isInCount }}"> <block wx:if="{{ isInCount }}">
<view wx:if="{{ useSlot }}" class="van-uploader__slot" bind:tap="startUpload"> <view class="van-uploader__slot" bind:tap="startUpload">
<slot /> <slot />
</view> </view>
<!-- 默认上传样式 --> <!-- 默认上传样式 -->
<view <view
wx:else
class="van-uploader__upload" class="van-uploader__upload"
style="width: {{ computedPreviewSize }}; height: {{ computedPreviewSize }};" style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
bind:tap="startUpload" bind:tap="startUpload"
> >
<van-icon name="plus" class="van-uploader__upload-icon" /> <van-icon name="plus" class="van-uploader__upload-icon" />

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.van-uploader__upload{position:relative;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:80px;height:80px;margin:0 8px 8px 0;background-color:#fff;border:1px dashed #ebedf0;border-radius:4px}.van-uploader__upload-icon{display:inline-block;width:24px;height:24px;color:#969799;font-size:24px}.van-uploader__upload-text{margin-top:8px;color:#969799;font-size:12px}.van-uploader__preview{position:relative;margin:0 8px 8px 0}.van-uploader__preview-image{display:block;width:80px;height:80px;border-radius:4px}.van-uploader__preview-delete{position:absolute;top:-8px;right:-8px;color:#969799;font-size:18px;background-color:#fff;border-radius:100%}.van-uploader__file{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;width:80px;height:80px;background-color:#f7f8fa;border-radius:4px}.van-uploader__file-icon{display:inline-block;width:20px;height:20px;color:#646566;font-size:20px}.van-uploader__file-name{box-sizing:border-box;width:100%;margin-top:8px;padding:0 5px;color:#646566;font-size:12px;text-align:center} @import '../common/index.wxss';.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.van-uploader__slot:empty{display:none}.van-uploader__slot:not(:empty)+.van-uploader__upload{display:none!important}.van-uploader__upload{position:relative;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:80px;height:80px;margin:0 8px 8px 0;background-color:#fff;border:1px dashed #ebedf0;border-radius:4px}.van-uploader__upload-icon{display:inline-block;width:24px;height:24px;color:#969799;font-size:24px}.van-uploader__upload-text{margin-top:8px;color:#969799;font-size:12px}.van-uploader__preview{position:relative;margin:0 8px 8px 0}.van-uploader__preview-image{display:block;width:80px;height:80px;border-radius:4px}.van-uploader__preview-delete{position:absolute;top:-8px;right:-8px;color:#969799;font-size:18px;background-color:#fff;border-radius:100%}.van-uploader__file{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;width:80px;height:80px;background-color:#f7f8fa;border-radius:4px}.van-uploader__file-icon{display:inline-block;width:20px;height:20px;color:#646566;font-size:20px}.van-uploader__file-name{box-sizing:border-box;width:100%;margin-top:8px;padding:0 5px;color:#646566;font-size:12px;text-align:center}

14
dist/wxs/add-unit.wxs vendored Normal file
View File

@ -0,0 +1,14 @@
/* eslint-disable */
var REGEXP = getRegExp('^\d+(\.\d+)?$');
function addUnit(value) {
if (value == null) {
return undefined;
}
return REGEXP.test('' + value) ? value + 'px' : value;
}
module.exports = {
addUnit: addUnit
};

5
dist/wxs/utils.wxs vendored
View File

@ -1,7 +1,10 @@
/* eslint-disable */
var bem = require('./bem.wxs').bem; var bem = require('./bem.wxs').bem;
var memoize = require('./memoize.wxs').memoize; var memoize = require('./memoize.wxs').memoize;
var addUnit = require('./add-unit.wxs').addUnit;
module.exports = { module.exports = {
bem: memoize(bem), bem: memoize(bem),
memoize: memoize memoize: memoize,
addUnit: addUnit
}; };

View File

@ -1,7 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
function emit(target, value) { function emit(target, value) {
target.$emit('input', value); target.$emit('input', value);
target.$emit('change', value); target.$emit('change', value);
@ -32,12 +31,9 @@ component_1.VantComponent({
}, },
iconSize: { iconSize: {
type: null, type: null,
observer: 'setSizeWithUnit' value: 20
} }
}, },
data: {
sizeWithUnit: '20px'
},
methods: { methods: {
emitChange: function (value) { emitChange: function (value) {
if (this.parent) { if (this.parent) {
@ -79,11 +75,6 @@ component_1.VantComponent({
emit(parent, parentValue); emit(parent, parentValue);
} }
} }
}, }
setSizeWithUnit: function (size) {
this.set({
sizeWithUnit: utils_1.addUnit(size)
});
},
} }
}); });

View File

@ -8,7 +8,7 @@
name="success" name="success"
size="0.8em" size="0.8em"
class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}" class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
style="font-size: {{ sizeWithUnit }};{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}" style="font-size: {{ utils.addUnit(iconSize) }};{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}"
custom-class="icon-class" custom-class="icon-class"
custom-style="line-height: 1.25em;" custom-style="line-height: 1.25em;"
/> />

View File

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

View File

@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var button_1 = require("../mixins/button"); var button_1 = require("../mixins/button");
var open_type_1 = require("../mixins/open-type"); var open_type_1 = require("../mixins/open-type");
var utils_1 = require("../common/utils");
var color_1 = require("../common/color"); var color_1 = require("../common/color");
component_1.VantComponent({ component_1.VantComponent({
mixins: [button_1.button, open_type_1.openType], mixins: [button_1.button, open_type_1.openType],
@ -21,10 +20,7 @@ component_1.VantComponent({
showCancelButton: Boolean, showCancelButton: Boolean,
closeOnClickOverlay: Boolean, closeOnClickOverlay: Boolean,
confirmButtonOpenType: String, confirmButtonOpenType: String,
width: { width: null,
type: null,
observer: 'setWidthWithUnit'
},
zIndex: { zIndex: {
type: Number, type: Number,
value: 2000 value: 2000
@ -112,11 +108,6 @@ component_1.VantComponent({
if (callback) { if (callback) {
callback(this); callback(this);
} }
},
setWidthWithUnit: function (val) {
this.setData({
widthWithUnit: utils_1.addUnit(val)
});
} }
} }
}); });

View File

@ -1,10 +1,12 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<van-popup <van-popup
show="{{ show }}" show="{{ show }}"
z-index="{{ zIndex }}" z-index="{{ zIndex }}"
overlay="{{ overlay }}" overlay="{{ overlay }}"
transition="{{ transition }}" transition="{{ transition }}"
custom-class="van-dialog {{ className }}" custom-class="van-dialog {{ className }}"
custom-style="{{ widthWithUnit ? 'width: ' + widthWithUnit + ';' : '' }}{{ customStyle }}" custom-style="width: {{ utils.addUnit(width) }};{{ customStyle }}"
overlay-style="{{ overlayStyle }}" overlay-style="{{ overlayStyle }}"
close-on-click-overlay="{{ closeOnClickOverlay }}" close-on-click-overlay="{{ closeOnClickOverlay }}"
bind:close="onClickOverlay" bind:close="onClickOverlay"

View File

@ -18,6 +18,7 @@ component_1.VantComponent({
color: String, color: String,
loading: Boolean, loading: Boolean,
disabled: Boolean, disabled: Boolean,
plain: Boolean,
type: { type: {
type: String, type: String,
value: 'danger' value: 'danger'
@ -33,10 +34,16 @@ component_1.VantComponent({
}, },
updateStyle: function () { updateStyle: function () {
var _a = this.parent.children, children = _a === void 0 ? [] : _a; var _a = this.parent.children, children = _a === void 0 ? [] : _a;
var length = children.length;
var index = children.indexOf(this); var index = children.indexOf(this);
var rightBorderLess = false;
if (length > 1) {
rightBorderLess = index !== length - 1;
}
this.setData({ this.setData({
isFirst: index === 0, isFirst: index === 0,
isLast: index === children.length - 1 rightBorderLess: rightBorderLess,
isLast: index === length - 1
}); });
} }
} }

View File

@ -5,10 +5,11 @@
lang="{{ lang }}" lang="{{ lang }}"
type="{{ type }}" type="{{ type }}"
color="{{ color }}" color="{{ color }}"
plain="{{ plain }}"
loading="{{ loading }}" loading="{{ loading }}"
disabled="{{ disabled }}" disabled="{{ disabled }}"
open-type="{{ openType }}" open-type="{{ openType }}"
custom-class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast }]) }}" custom-class="{{ utils.bem('goods-action-button', [type, { first: isFirst, last: isLast, plain : plain, ordinary: !plain }])}} {{ rightBorderLess ?'van-goods-action-button--no-right-border': ''}}"
business-id="{{ businessId }}" business-id="{{ businessId }}"
session-from="{{ sessionFrom }}" session-from="{{ sessionFrom }}"
app-parameter="{{ appParameter }}" app-parameter="{{ appParameter }}"

View File

@ -1 +1 @@
@import '../common/index.wxss';:host{-webkit-flex:1;flex:1}.van-goods-action-button{border:none!important;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))}@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{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}}

View File

@ -1,15 +1,11 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
component_1.VantComponent({ component_1.VantComponent({
props: { props: {
dot: Boolean, dot: Boolean,
info: null, info: null,
size: { size: null,
type: null,
observer: 'setSizeWithUnit'
},
color: String, color: String,
customStyle: String, customStyle: String,
classPrefix: { classPrefix: {
@ -25,17 +21,9 @@ component_1.VantComponent({
} }
} }
}, },
data: {
sizeWithUnit: null,
},
methods: { methods: {
onClick: function () { onClick: function () {
this.$emit('click'); this.$emit('click');
},
setSizeWithUnit: function (size) {
this.setData({
sizeWithUnit: utils_1.addUnit(size)
});
} }
} }
}); });

View File

@ -1,6 +1,8 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view <view
class="custom-class {{ classPrefix }} {{ isImageName ? 'van-icon--image' : classPrefix + '-' + name }}" class="custom-class {{ classPrefix }} {{ isImageName ? 'van-icon--image' : classPrefix + '-' + name }}"
style="{{ color ? 'color: ' + color + ';' : '' }}{{ size ? 'font-size: ' + sizeWithUnit + ';' : '' }}{{ customStyle }}" style="color: {{ color }};font-size: {{ utils.addUnit(size) }};{{ customStyle }}"
bind:tap="onClick" bind:tap="onClick"
> >
<van-info <van-info

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
component_1.VantComponent({ component_1.VantComponent({
props: { props: {
color: String, color: String,
@ -10,25 +9,7 @@ component_1.VantComponent({
type: String, type: String,
value: 'circular' value: 'circular'
}, },
size: { size: String,
type: String, textSize: String
observer: 'setSizeWithUnit'
},
textSize: {
type: String,
observer: 'setTextSizeWithUnit'
}
},
methods: {
setSizeWithUnit: function (size) {
this.setData({
sizeWithUnit: utils_1.addUnit(size)
});
},
setTextSizeWithUnit: function (size) {
this.set({
textSizeWithUnit: utils_1.addUnit(size)
});
}
} }
}); });

View File

@ -1,7 +1,9 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="custom-class van-loading {{ vertical ? 'van-loading--vertical' : '' }}"> <view class="custom-class van-loading {{ vertical ? 'van-loading--vertical' : '' }}">
<view <view
class="van-loading__spinner van-loading__spinner--{{ type }}" class="van-loading__spinner van-loading__spinner--{{ type }}"
style="color: {{ color }}; width: {{ sizeWithUnit }}; height: {{ sizeWithUnit }}" style="color: {{ color }}; width: {{ utils.addUnit(size) }}; height: {{ utils.addUnit(size) }}"
> >
<view <view
wx:if="{{ type === 'spinner' }}" wx:if="{{ type === 'spinner' }}"
@ -10,7 +12,7 @@
class="van-loading__dot" class="van-loading__dot"
/> />
</view> </view>
<view class="van-loading__text" style="font-size: {{ textSizeWithUnit }};"> <view class="van-loading__text" style="font-size: {{ utils.addUnit(textSize) }};">
<slot /> <slot />
</view> </view>
</view> </view>

View File

@ -3,15 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.behavior = Behavior({ exports.behavior = Behavior({
methods: { methods: {
set: function (data, callback) { set: function (data, callback) {
var _this = this; this.setData(data, callback);
return new Promise(function (resolve) { return new Promise(function (resolve) { return wx.nextTick(resolve); });
_this.setData(data, function () {
if (callback && typeof callback === 'function') {
callback.call(_this);
}
resolve();
});
});
} }
} }
}); });

View File

@ -53,6 +53,9 @@ component_1.VantComponent({
watch: { watch: {
text: function () { text: function () {
this.setData({}, this.init); this.setData({}, this.init);
},
speed: function () {
this.setData({}, this.init);
} }
}, },
created: function () { created: function () {

View File

@ -36,9 +36,8 @@ component_1.VantComponent({
var _this = this; var _this = this;
var _a = this.data, duration = _a.duration, onOpened = _a.onOpened; var _a = this.data, duration = _a.duration, onOpened = _a.onOpened;
clearTimeout(this.timer); clearTimeout(this.timer);
this.setData({ this.setData({ show: true });
show: true wx.nextTick(onOpened);
}, onOpened);
if (duration > 0 && duration !== Infinity) { if (duration > 0 && duration !== Infinity) {
this.timer = setTimeout(function () { this.timer = setTimeout(function () {
_this.hide(); _this.hide();
@ -48,9 +47,8 @@ component_1.VantComponent({
hide: function () { hide: function () {
var onClose = this.data.onClose; var onClose = this.data.onClose;
clearTimeout(this.timer); clearTimeout(this.timer);
this.setData({ this.setData({ show: false });
show: false wx.nextTick(onClose);
}, onClose);
}, },
onTap: function (event) { onTap: function (event) {
var onClick = this.data.onClick; var onClick = this.data.onClick;

View File

@ -9,7 +9,10 @@
class="van-notify van-notify--{{ type }}" class="van-notify van-notify--{{ type }}"
style="background:{{ background }};color:{{ color }};" style="background:{{ background }};color:{{ color }};"
> >
<view wx:if="{{ safeAreaInsetTop }}" class="van-notify__safe-area"></view> <view
wx:if="{{ safeAreaInsetTop }}"
style="height: {{ statusBarHeight }}px"
></view>
<text>{{ message }}</text> <text>{{ message }}</text>
</view> </view>
</van-transition> </van-transition>

View File

@ -9,6 +9,7 @@ var defaultOptions = {
duration: 3000, duration: 3000,
zIndex: 110, zIndex: 110,
color: color_1.WHITE, color: color_1.WHITE,
safeAreaInsetTop: false,
onClick: function () { }, onClick: function () { },
onOpened: function () { }, onOpened: function () { },
onClose: function () { } onClose: function () { }
@ -27,7 +28,7 @@ function Notify(options) {
delete options.context; delete options.context;
delete options.selector; delete options.selector;
if (notify) { if (notify) {
notify.set(options); notify.setData(options);
notify.show(); notify.show();
return notify; return notify;
} }

View File

@ -2,7 +2,6 @@
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var color_1 = require("../common/color"); var color_1 = require("../common/color");
var utils_1 = require("../common/utils");
component_1.VantComponent({ component_1.VantComponent({
props: { props: {
inactive: Boolean, inactive: Boolean,
@ -24,17 +23,7 @@ component_1.VantComponent({
}, },
strokeWidth: { strokeWidth: {
type: null, type: null,
observer: 'setStrokeWidthUnit' value: 4
}
},
data: {
strokeWidthUnit: '4px'
},
methods: {
setStrokeWidthUnit: function (val) {
this.setData({
strokeWidthUnit: utils_1.addUnit(val)
});
} }
} }
}); });

View File

@ -1,8 +1,9 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="getters" /> <wxs src="./index.wxs" module="getters" />
<view <view
class="van-progress custom-class" class="van-progress custom-class"
style="height: {{ strokeWidthUnit }}; {{ trackColor ? 'background: ' + trackColor : '' }}" style="height: {{ utils.addUnit(strokeWidth) }}; {{ trackColor ? 'background: ' + trackColor : '' }}"
> >
<view <view
class="van-progress__portion" class="van-progress__portion"

View File

@ -1,7 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
component_1.VantComponent({ component_1.VantComponent({
field: true, field: true,
relation: { relation: {
@ -31,18 +30,10 @@ component_1.VantComponent({
}, },
iconSize: { iconSize: {
type: null, type: null,
observer: 'setIconSizeUnit' value: 20
} }
}, },
data: {
iconSizeWithUnit: '20px'
},
methods: { methods: {
setIconSizeUnit: function (val) {
this.setData({
iconSizeWithUnit: utils_1.addUnit(val)
});
},
emitChange: function (value) { emitChange: function (value) {
var instance = this.parent || this; var instance = this.parent || this;
instance.$emit('input', value); instance.$emit('input', value);

View File

@ -8,15 +8,15 @@
> >
<slot /> <slot />
</view> </view>
<view class="van-radio__icon-wrap" style="font-size: {{ iconSizeWithUnit }};" bindtap="onChange"> <view class="van-radio__icon-wrap" style="font-size: {{ utils.addUnit(iconSize) }};" bindtap="onChange">
<slot wx:if="{{ useIconSlot }}" name="icon" /> <slot wx:if="{{ useIconSlot }}" name="icon" />
<van-icon <van-icon
wx:else wx:else
name="success" name="success"
class="{{ utils.bem('radio__icon', [shape, { disabled, checked: value === name }]) }}" class="{{ utils.bem('radio__icon', [shape, { disabled, checked: value === name }]) }}"
style="{{ checkedColor && !disabled && value === name ? 'border-color:' + checkedColor + '; background-color:' + checkedColor + ';' : '' }}" style="font-size: {{ utils.addUnit(iconSize) }};{{ checkedColor && !disabled && value === name ? 'border-color:' + checkedColor + '; background-color:' + checkedColor + ';' : '' }}"
custom-class="icon-class" custom-class="icon-class"
custom-style="line-height: {{ iconSizeWithUnit }};font-size: .8em;display: block;" custom-style="line-height: {{ utils.addUnit(iconSize) }};font-size: .8em;display: block;"
/> />
</view> </view>
<view <view

View File

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

View File

@ -12,19 +12,22 @@ var __assign = (this && this.__assign) || function () {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
component_1.VantComponent({ component_1.VantComponent({
field: true, field: true,
classes: ['icon-class'], classes: ['icon-class'],
props: { props: {
value: Number, value: {
type: Number,
observer: function (value) {
if (value !== this.data.innerValue) {
this.setData({ innerValue: value });
}
}
},
readonly: Boolean, readonly: Boolean,
disabled: Boolean, disabled: Boolean,
allowHalf: Boolean, allowHalf: Boolean,
size: { size: null,
type: null,
observer: 'setSizeWithUnit'
},
icon: { icon: {
type: String, type: String,
value: 'star' value: 'star'
@ -49,38 +52,16 @@ component_1.VantComponent({
type: Number, type: Number,
value: 5 value: 5
}, },
gutter: { gutter: null,
type: null,
observer: 'setGutterWithUnit'
},
touchable: { touchable: {
type: Boolean, type: Boolean,
value: true value: true
} }
}, },
data: { data: {
innerValue: 0, innerValue: 0
gutterWithUnit: undefined,
sizeWithUnit: null
},
watch: {
value: function (value) {
if (value !== this.data.innerValue) {
this.setData({ innerValue: value });
}
}
}, },
methods: { methods: {
setGutterWithUnit: function (val) {
this.setData({
gutterWithUnit: utils_1.addUnit(val)
});
},
setSizeWithUnit: function (size) {
this.setData({
sizeWithUnit: utils_1.addUnit(size)
});
},
onSelect: function (event) { onSelect: function (event) {
var data = this.data; var data = this.data;
var score = event.currentTarget.dataset.score; var score = event.currentTarget.dataset.score;

View File

@ -8,12 +8,12 @@
class="van-rate__item" class="van-rate__item"
wx:for="{{ count }}" wx:for="{{ count }}"
wx:key="index" wx:key="index"
style="padding-right: {{ index !== count - 1 ? gutterWithUnit : '' }}" style="padding-right: {{ index !== count - 1 ? utils.addUnit(gutter) : '' }}"
> >
<van-icon <van-icon
name="{{ index + 1 <= innerValue ? icon : voidIcon }}" name="{{ index + 1 <= innerValue ? icon : voidIcon }}"
class="van-rate__icon" class="van-rate__icon"
style="font-size :{{ size? sizeWithUnit : ''}}" style="font-size: {{ utils.addUnit(size) }}"
custom-class="icon-class" custom-class="icon-class"
data-score="{{ index }}" data-score="{{ index }}"
color="{{ disabled ? disabledColor : index + 1 <= innerValue ? color : voidColor }}" color="{{ disabled ? disabledColor : index + 1 <= innerValue ? color : voidColor }}"
@ -24,7 +24,7 @@
wx:if="{{ allowHalf }}" wx:if="{{ allowHalf }}"
name="{{ index + 0.5 <= innerValue ? icon : voidIcon }}" name="{{ index + 0.5 <= innerValue ? icon : voidIcon }}"
class="{{ utils.bem('rate__icon', ['half']) }}" class="{{ utils.bem('rate__icon', ['half']) }}"
style="font-size :{{ size? sizeWithUnit : ''}}" style="font-size: {{ utils.addUnit(size) }}"
custom-class="icon-class" custom-class="icon-class"
data-score="{{ index - 0.5 }}" data-score="{{ index - 0.5 }}"
color="{{ disabled ? disabledColor : index + 0.5 <= innerValue ? color : voidColor }}" color="{{ disabled ? disabledColor : index + 0.5 <= innerValue ? color : voidColor }}"

View File

@ -15,6 +15,10 @@ component_1.VantComponent({
type: String, type: String,
value: color_1.GREEN value: color_1.GREEN
}, },
inactiveColor: {
type: String,
value: color_1.GRAY_DARK
},
activeIcon: { activeIcon: {
type: String, type: String,
value: 'checked' value: 'checked'

View File

@ -6,6 +6,7 @@
wx:for="{{ steps }}" wx:for="{{ steps }}"
wx:key="index" wx:key="index"
class="{{ utils.bem('step', [direction, status(index, active)]) }} van-hairline" class="{{ utils.bem('step', [direction, status(index, active)]) }} van-hairline"
style="{{ status(index, active) === 'inactive' ? 'color: ' + inactiveColor: '' }}"
> >
<view class="van-step__title" style="{{ index === active ? 'color: ' + activeColor : '' }}"> <view class="van-step__title" style="{{ index === active ? 'color: ' + activeColor : '' }}">
<view>{{ item.text }}</view> <view>{{ item.text }}</view>
@ -15,14 +16,14 @@
<block wx:if="{{ index !== active }}"> <block wx:if="{{ index !== active }}">
<van-icon <van-icon
wx:if="{{ inactiveIcon }}" wx:if="{{ inactiveIcon }}"
color="#969799" color="{{ status(index, active) === 'inactive' ? inactiveColor: activeColor }}"
name="{{ inactiveIcon }}" name="{{ inactiveIcon }}"
custom-class="van-step__icon" custom-class="van-step__icon"
/> />
<view <view
wx:else wx:else
class="van-step__circle" class="van-step__circle"
style="{{ index < active ? 'background-color: ' + activeColor : '' }}" style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}"
/> />
</block> </block>
@ -30,7 +31,7 @@
</view> </view>
<view <view
wx:if="{{ index !== steps.length - 1 }}" wx:if="{{ index !== steps.length - 1 }}"
class="van-step__line" style="{{ index < active ? 'background-color: ' + activeColor : '' }}" class="van-step__line" style="{{ 'background-color: ' + (index < active ? activeColor : inactiveColor) }}"
/> />
</view> </view>
</view> </view>
@ -44,7 +45,7 @@ function get(index, active) {
return 'process'; return 'process';
} }
return ''; return 'inactive';
} }
module.exports = get; module.exports = get;

View File

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

View File

@ -1,7 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var utils_1 = require("../common/utils");
component_1.VantComponent({ component_1.VantComponent({
classes: [ classes: [
'main-item-class', 'main-item-class',
@ -24,8 +23,7 @@ component_1.VantComponent({
}, },
height: { height: {
type: [Number, String], type: [Number, String],
value: 300, value: 300
observer: 'updateHeight'
}, },
max: { max: {
type: Number, type: Number,
@ -35,9 +33,6 @@ component_1.VantComponent({
data: { data: {
subItems: [] subItems: []
}, },
created: function () {
this.updateHeight();
},
methods: { methods: {
// 当一个子项被选择时 // 当一个子项被选择时
onSelectItem: function (event) { onSelectItem: function (event) {
@ -66,11 +61,6 @@ component_1.VantComponent({
var _a = this.data, items = _a.items, mainActiveIndex = _a.mainActiveIndex; var _a = this.data, items = _a.items, mainActiveIndex = _a.mainActiveIndex;
var _b = (items[mainActiveIndex] || {}).children, children = _b === void 0 ? [] : _b; var _b = (items[mainActiveIndex] || {}).children, children = _b === void 0 ? [] : _b;
return this.set({ subItems: children }); return this.set({ subItems: children });
},
updateHeight: function () {
this.setData({
innerHeight: utils_1.addUnit(this.data.height)
});
} }
} }
}); });

View File

@ -3,7 +3,7 @@
<view <view
class="van-tree-select" class="van-tree-select"
style="height: {{ innerHeight }}" style="height: {{ utils.addUnit(height) }}"
> >
<scroll-view scroll-y class="van-tree-select__nav"> <scroll-view scroll-y class="van-tree-select__nav">
<van-sidebar active-key="{{ mainActiveIndex }}" bind:change="onClickNav" custom-class="van-tree-select__nav__inner"> <van-sidebar active-key="{{ mainActiveIndex }}" bind:change="onClickNav" custom-class="van-tree-select__nav__inner">

View File

@ -13,18 +13,15 @@ var __assign = (this && this.__assign) || function () {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var component_1 = require("../common/component"); var component_1 = require("../common/component");
var utils_1 = require("./utils"); var utils_1 = require("./utils");
var utils_2 = require("../common/utils");
component_1.VantComponent({ component_1.VantComponent({
props: { props: {
disabled: Boolean, disabled: Boolean,
multiple: Boolean, multiple: Boolean,
uploadText: String, uploadText: String,
useSlot: Boolean,
useBeforeRead: Boolean, useBeforeRead: Boolean,
previewSize: { previewSize: {
type: null, type: null,
value: 90, value: 90
observer: 'setComputedPreviewSize'
}, },
name: { name: {
type: [Number, String], type: [Number, String],
@ -34,6 +31,14 @@ component_1.VantComponent({
type: String, type: String,
value: 'image' value: 'image'
}, },
sizeType: {
type: Array,
value: ['original', 'compressed']
},
capture: {
type: Array,
value: ['album', 'camera']
},
fileList: { fileList: {
type: Array, type: Array,
value: [], value: [],
@ -75,17 +80,12 @@ component_1.VantComponent({
var lists = fileList.map(function (item) { return (__assign(__assign({}, item), { isImage: typeof item.isImage === 'undefined' ? utils_1.isImageFile(item) : item.isImage })); }); var lists = fileList.map(function (item) { return (__assign(__assign({}, item), { isImage: typeof item.isImage === 'undefined' ? utils_1.isImageFile(item) : item.isImage })); });
this.setData({ lists: lists, isInCount: lists.length < maxCount }); this.setData({ lists: lists, isInCount: lists.length < maxCount });
}, },
setComputedPreviewSize: function (val) {
this.setData({
computedPreviewSize: utils_2.addUnit(val)
});
},
startUpload: function () { startUpload: function () {
var _this = this; var _this = this;
if (this.data.disabled) if (this.data.disabled)
return; return;
var _a = this.data, _b = _a.name, name = _b === void 0 ? '' : _b, _c = _a.capture, capture = _c === void 0 ? ['album', 'camera'] : _c, _d = _a.maxCount, maxCount = _d === void 0 ? 100 : _d, _e = _a.multiple, multiple = _e === void 0 ? false : _e, maxSize = _a.maxSize, accept = _a.accept, lists = _a.lists, _f = _a.useBeforeRead // 是否定义了 beforeRead var _a = this.data, _b = _a.name, name = _b === void 0 ? '' : _b, capture = _a.capture, maxCount = _a.maxCount, multiple = _a.multiple, maxSize = _a.maxSize, accept = _a.accept, sizeType = _a.sizeType, lists = _a.lists, _c = _a.useBeforeRead // 是否定义了 beforeRead
, useBeforeRead = _f === void 0 ? false : _f // 是否定义了 beforeRead , useBeforeRead = _c === void 0 ? false : _c // 是否定义了 beforeRead
; ;
var chooseFile = null; var chooseFile = null;
var newMaxCount = maxCount - lists.length; var newMaxCount = maxCount - lists.length;
@ -95,6 +95,7 @@ component_1.VantComponent({
wx.chooseImage({ wx.chooseImage({
count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1, count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1,
sourceType: capture, sourceType: capture,
sizeType: sizeType,
success: resolve, success: resolve,
fail: reject fail: reject
}); });
@ -110,7 +111,8 @@ component_1.VantComponent({
}); });
}); });
} }
chooseFile.then(function (res) { chooseFile
.then(function (res) {
var file = multiple ? res.tempFiles : res.tempFiles[0]; var file = multiple ? res.tempFiles : res.tempFiles[0];
// 检查文件大小 // 检查文件大小
if (file instanceof Array) { if (file instanceof Array) {
@ -140,6 +142,9 @@ component_1.VantComponent({
else { else {
_this.$emit('after-read', { file: file, name: name }); _this.$emit('after-read', { file: file, name: name });
} }
})
.catch(function (error) {
_this.$emit('error', error);
}); });
}, },
deleteItem: function (event) { deleteItem: function (event) {

View File

@ -15,14 +15,14 @@
src="{{ item.url || item.path }}" src="{{ item.url || item.path }}"
alt="{{ item.name || ('图片' + index) }}" alt="{{ item.name || ('图片' + index) }}"
class="van-uploader__preview-image" class="van-uploader__preview-image"
style="width: {{ computedPreviewSize }}; height: {{ computedPreviewSize }};" style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
data-url="{{ item.url || item.path }}" data-url="{{ item.url || item.path }}"
bind:tap="doPreviewImage" bind:tap="doPreviewImage"
/> />
<view <view
wx:else wx:else
class="van-uploader__file" class="van-uploader__file"
style="width: {{ computedPreviewSize }}; height: {{ computedPreviewSize }};" style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
> >
<van-icon name="description" class="van-uploader__file-icon" /> <van-icon name="description" class="van-uploader__file-icon" />
<view class="van-uploader__file-name van-ellipsis">{{ item.name || item.url || item.path }}</view> <view class="van-uploader__file-name van-ellipsis">{{ item.name || item.url || item.path }}</view>
@ -38,15 +38,14 @@
<!-- 上传样式 --> <!-- 上传样式 -->
<block wx:if="{{ isInCount }}"> <block wx:if="{{ isInCount }}">
<view wx:if="{{ useSlot }}" class="van-uploader__slot" bind:tap="startUpload"> <view class="van-uploader__slot" bind:tap="startUpload">
<slot /> <slot />
</view> </view>
<!-- 默认上传样式 --> <!-- 默认上传样式 -->
<view <view
wx:else
class="van-uploader__upload" class="van-uploader__upload"
style="width: {{ computedPreviewSize }}; height: {{ computedPreviewSize }};" style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
bind:tap="startUpload" bind:tap="startUpload"
> >
<van-icon name="plus" class="van-uploader__upload-icon" /> <van-icon name="plus" class="van-uploader__upload-icon" />

View File

@ -1 +1 @@
@import '../common/index.wxss';.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.van-uploader__upload{position:relative;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:80px;height:80px;margin:0 8px 8px 0;background-color:#fff;border:1px dashed #ebedf0;border-radius:4px}.van-uploader__upload-icon{display:inline-block;width:24px;height:24px;color:#969799;font-size:24px}.van-uploader__upload-text{margin-top:8px;color:#969799;font-size:12px}.van-uploader__preview{position:relative;margin:0 8px 8px 0}.van-uploader__preview-image{display:block;width:80px;height:80px;border-radius:4px}.van-uploader__preview-delete{position:absolute;top:-8px;right:-8px;color:#969799;font-size:18px;background-color:#fff;border-radius:100%}.van-uploader__file{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;width:80px;height:80px;background-color:#f7f8fa;border-radius:4px}.van-uploader__file-icon{display:inline-block;width:20px;height:20px;color:#646566;font-size:20px}.van-uploader__file-name{box-sizing:border-box;width:100%;margin-top:8px;padding:0 5px;color:#646566;font-size:12px;text-align:center} @import '../common/index.wxss';.van-uploader{position:relative;display:inline-block}.van-uploader__wrapper{display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap}.van-uploader__slot:empty{display:none}.van-uploader__slot:not(:empty)+.van-uploader__upload{display:none!important}.van-uploader__upload{position:relative;display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:80px;height:80px;margin:0 8px 8px 0;background-color:#fff;border:1px dashed #ebedf0;border-radius:4px}.van-uploader__upload-icon{display:inline-block;width:24px;height:24px;color:#969799;font-size:24px}.van-uploader__upload-text{margin-top:8px;color:#969799;font-size:12px}.van-uploader__preview{position:relative;margin:0 8px 8px 0}.van-uploader__preview-image{display:block;width:80px;height:80px;border-radius:4px}.van-uploader__preview-delete{position:absolute;top:-8px;right:-8px;color:#969799;font-size:18px;background-color:#fff;border-radius:100%}.van-uploader__file{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;width:80px;height:80px;background-color:#f7f8fa;border-radius:4px}.van-uploader__file-icon{display:inline-block;width:20px;height:20px;color:#646566;font-size:20px}.van-uploader__file-name{box-sizing:border-box;width:100%;margin-top:8px;padding:0 5px;color:#646566;font-size:12px;text-align:center}

14
lib/wxs/add-unit.wxs Normal file
View File

@ -0,0 +1,14 @@
/* eslint-disable */
var REGEXP = getRegExp('^\d+(\.\d+)?$');
function addUnit(value) {
if (value == null) {
return undefined;
}
return REGEXP.test('' + value) ? value + 'px' : value;
}
module.exports = {
addUnit: addUnit
};

View File

@ -1,7 +1,10 @@
/* eslint-disable */
var bem = require('./bem.wxs').bem; var bem = require('./bem.wxs').bem;
var memoize = require('./memoize.wxs').memoize; var memoize = require('./memoize.wxs').memoize;
var addUnit = require('./add-unit.wxs').addUnit;
module.exports = { module.exports = {
bem: memoize(bem), bem: memoize(bem),
memoize: memoize memoize: memoize,
addUnit: addUnit
}; };