mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
build: compile 1.0.0-beta.2
This commit is contained in:
parent
31feeac3bd
commit
4e8ffe29ad
1
dist/action-sheet/index.js
vendored
1
dist/action-sheet/index.js
vendored
@ -4,6 +4,7 @@ VantComponent({
|
|||||||
show: Boolean,
|
show: Boolean,
|
||||||
title: String,
|
title: String,
|
||||||
cancelText: String,
|
cancelText: String,
|
||||||
|
description: String,
|
||||||
round: {
|
round: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true
|
value: true
|
||||||
|
3
dist/action-sheet/index.wxml
vendored
3
dist/action-sheet/index.wxml
vendored
@ -19,6 +19,9 @@
|
|||||||
bind:click="onClose"
|
bind:click="onClose"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
<view wx:if="{{ description }}" class="van-action-sheet__description">
|
||||||
|
{{ description }}
|
||||||
|
</view>
|
||||||
<view wx:if="{{ actions && actions.length }}">
|
<view wx:if="{{ actions && actions.length }}">
|
||||||
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
|
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
|
||||||
<button
|
<button
|
||||||
|
2
dist/action-sheet/index.wxss
vendored
2
dist/action-sheet/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;color:#333;color:var(--text-color,#333)}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;font-size:16px;line-height:50px;text-align:center;background-color:#fff;background-color:var(--white,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel{height:60px}.van-action-sheet__cancel:before{display:block;height:10px;content:" ";background-color:#f8f8f8;background-color:var(--background-color,#f8f8f8)}.van-action-sheet__item--disabled{color:#c9c9c9;color:var(--gray,#c9c9c9)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--white,#fff)}.van-action-sheet__subname{margin-left:5px;font-size:12px;color:#7d7e80;color:var(--gray-darker,#7d7e80)}.van-action-sheet__header{font-weight:500;font-size:16px;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;color:var(--gray-dark,#999)}
|
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;color:#333;color:var(--text-color,#333)}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;font-size:16px;line-height:50px;text-align:center;background-color:#fff;background-color:var(--white,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel{height:60px}.van-action-sheet__cancel:before{display:block;height:10px;content:" ";background-color:#f8f8f8;background-color:var(--background-color,#f8f8f8)}.van-action-sheet__item--disabled{color:#c9c9c9;color:var(--gray,#c9c9c9)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--white,#fff)}.van-action-sheet__subname{margin-left:5px;font-size:12px;color:#7d7e80;color:var(--gray-darker,#7d7e80)}.van-action-sheet__header{font-weight:500;font-size:16px;line-height:44px;text-align:center}.van-action-sheet__description{padding:16px;color:#7d7e80;font-size:14px;line-height:20px;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;color:var(--gray-dark,#999)}
|
58
dist/area/index.js
vendored
58
dist/area/index.js
vendored
@ -1,5 +1,6 @@
|
|||||||
import { VantComponent } from '../common/component';
|
import { VantComponent } from '../common/component';
|
||||||
import { pickerProps } from '../picker/shared';
|
import { pickerProps } from '../picker/shared';
|
||||||
|
const COLUMNSPLACEHOLDERCODE = '000000';
|
||||||
VantComponent({
|
VantComponent({
|
||||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||||
props: Object.assign(Object.assign({}, pickerProps), { value: String, areaList: {
|
props: Object.assign(Object.assign({}, pickerProps), { value: String, areaList: {
|
||||||
@ -8,10 +9,22 @@ VantComponent({
|
|||||||
}, columnsNum: {
|
}, columnsNum: {
|
||||||
type: null,
|
type: null,
|
||||||
value: 3
|
value: 3
|
||||||
|
}, columnsPlaceholder: {
|
||||||
|
type: Array,
|
||||||
|
observer(val) {
|
||||||
|
this.setData({
|
||||||
|
typeToColumnsPlaceholder: {
|
||||||
|
province: val[0] || '',
|
||||||
|
city: val[1] || '',
|
||||||
|
county: val[2] || '',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} }),
|
} }),
|
||||||
data: {
|
data: {
|
||||||
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||||
displayColumns: [{ values: [] }, { values: [] }, { values: [] }]
|
displayColumns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||||
|
typeToColumnsPlaceholder: {}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value(value) {
|
value(value) {
|
||||||
@ -41,20 +54,37 @@ VantComponent({
|
|||||||
this.emit('cancel', event.detail);
|
this.emit('cancel', event.detail);
|
||||||
},
|
},
|
||||||
onConfirm(event) {
|
onConfirm(event) {
|
||||||
this.emit('confirm', event.detail);
|
const { index } = event.detail;
|
||||||
|
let { value } = event.detail;
|
||||||
|
value = this.parseOutputValues(value);
|
||||||
|
this.emit('confirm', { value, index });
|
||||||
},
|
},
|
||||||
emit(type, detail) {
|
emit(type, detail) {
|
||||||
detail.values = detail.value;
|
detail.values = detail.value;
|
||||||
delete detail.value;
|
delete detail.value;
|
||||||
this.$emit(type, detail);
|
this.$emit(type, detail);
|
||||||
},
|
},
|
||||||
|
// parse output columns data
|
||||||
|
parseOutputValues(values) {
|
||||||
|
const { columnsPlaceholder } = this.data;
|
||||||
|
return values.map((value = {}, index) => {
|
||||||
|
value = JSON.parse(JSON.stringify(value));
|
||||||
|
if (!value.code || value.name === columnsPlaceholder[index]) {
|
||||||
|
value.code = '';
|
||||||
|
value.name = '';
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
},
|
||||||
onChange(event) {
|
onChange(event) {
|
||||||
const { index, picker, value } = event.detail;
|
const { index, picker, value } = event.detail;
|
||||||
this.code = value[index].code;
|
this.code = value[index].code;
|
||||||
|
let getValues = picker.getValues();
|
||||||
|
getValues = this.parseOutputValues(getValues);
|
||||||
this.setValues().then(() => {
|
this.setValues().then(() => {
|
||||||
this.$emit('change', {
|
this.$emit('change', {
|
||||||
picker,
|
picker,
|
||||||
values: picker.getValues(),
|
values: getValues,
|
||||||
index
|
index
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -64,6 +94,7 @@ VantComponent({
|
|||||||
return (areaList && areaList[`${type}_list`]) || {};
|
return (areaList && areaList[`${type}_list`]) || {};
|
||||||
},
|
},
|
||||||
getList(type, code) {
|
getList(type, code) {
|
||||||
|
const { typeToColumnsPlaceholder } = this.data;
|
||||||
let result = [];
|
let result = [];
|
||||||
if (type !== 'province' && !code) {
|
if (type !== 'province' && !code) {
|
||||||
return result;
|
return result;
|
||||||
@ -80,6 +111,14 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
result = result.filter(item => item.code.indexOf(code) === 0);
|
result = result.filter(item => item.code.indexOf(code) === 0);
|
||||||
}
|
}
|
||||||
|
if (typeToColumnsPlaceholder[type] && result.length) {
|
||||||
|
// set columns placeholder
|
||||||
|
const codeFill = type === 'province' ? '' : type === 'city' ? COLUMNSPLACEHOLDERCODE.slice(2, 4) : COLUMNSPLACEHOLDERCODE.slice(4, 6);
|
||||||
|
result.unshift({
|
||||||
|
code: `${code}${codeFill}`,
|
||||||
|
name: typeToColumnsPlaceholder[type]
|
||||||
|
});
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
getIndex(type, code) {
|
getIndex(type, code) {
|
||||||
@ -99,7 +138,18 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
setValues() {
|
setValues() {
|
||||||
const county = this.getConfig('county');
|
const county = this.getConfig('county');
|
||||||
let code = this.code || Object.keys(county)[0] || '';
|
let { code } = this;
|
||||||
|
if (!code) {
|
||||||
|
if (this.data.columnsPlaceholder.length) {
|
||||||
|
code = COLUMNSPLACEHOLDERCODE;
|
||||||
|
}
|
||||||
|
else if (Object.keys(county)[0]) {
|
||||||
|
code = Object.keys(county)[0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
code = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
const province = this.getList('province');
|
const province = this.getList('province');
|
||||||
const city = this.getList('city', code.slice(0, 2));
|
const city = this.getList('city', code.slice(0, 2));
|
||||||
const picker = this.getPicker();
|
const picker = this.getPicker();
|
||||||
|
1
dist/count-down/index.d.ts
vendored
Normal file
1
dist/count-down/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export {};
|
96
dist/count-down/index.js
vendored
Normal file
96
dist/count-down/index.js
vendored
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
import { VantComponent } from '../common/component';
|
||||||
|
import { isSameSecond, parseFormat, parseTimeData } from './utils';
|
||||||
|
function simpleTick(fn) {
|
||||||
|
return setTimeout(fn, 30);
|
||||||
|
}
|
||||||
|
VantComponent({
|
||||||
|
props: {
|
||||||
|
useSlot: Boolean,
|
||||||
|
millisecond: Boolean,
|
||||||
|
time: {
|
||||||
|
type: Number,
|
||||||
|
observer: 'reset'
|
||||||
|
},
|
||||||
|
format: {
|
||||||
|
type: String,
|
||||||
|
value: 'HH:mm:ss'
|
||||||
|
},
|
||||||
|
autoStart: {
|
||||||
|
type: Boolean,
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
timeData: parseTimeData(0),
|
||||||
|
formattedTime: '0'
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 开始
|
||||||
|
start() {
|
||||||
|
if (this.counting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.counting = true;
|
||||||
|
this.endTime = Date.now() + this.remain;
|
||||||
|
this.tick();
|
||||||
|
},
|
||||||
|
// 暂停
|
||||||
|
pause() {
|
||||||
|
this.counting = false;
|
||||||
|
clearTimeout(this.tid);
|
||||||
|
},
|
||||||
|
// 重置
|
||||||
|
reset() {
|
||||||
|
this.pause();
|
||||||
|
this.remain = this.data.time;
|
||||||
|
this.setRemain(this.remain);
|
||||||
|
if (this.data.autoStart) {
|
||||||
|
this.start();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tick() {
|
||||||
|
if (this.data.millisecond) {
|
||||||
|
this.microTick();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.macroTick();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
microTick() {
|
||||||
|
this.tid = simpleTick(() => {
|
||||||
|
this.setRemain(this.getRemain());
|
||||||
|
if (this.remain !== 0) {
|
||||||
|
this.microTick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
macroTick() {
|
||||||
|
this.tid = simpleTick(() => {
|
||||||
|
const remain = this.getRemain();
|
||||||
|
if (!isSameSecond(remain, this.remain) || remain === 0) {
|
||||||
|
this.setRemain(remain);
|
||||||
|
}
|
||||||
|
if (this.remain !== 0) {
|
||||||
|
this.macroTick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getRemain() {
|
||||||
|
return Math.max(this.endTime - Date.now(), 0);
|
||||||
|
},
|
||||||
|
setRemain(remain) {
|
||||||
|
this.remain = remain;
|
||||||
|
const timeData = parseTimeData(remain);
|
||||||
|
if (this.data.useSlot) {
|
||||||
|
this.$emit('change', timeData);
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
formattedTime: parseFormat(this.data.format, timeData)
|
||||||
|
});
|
||||||
|
if (remain === 0) {
|
||||||
|
this.pause();
|
||||||
|
this.$emit('finish');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
3
dist/count-down/index.json
vendored
Normal file
3
dist/count-down/index.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"component": true
|
||||||
|
}
|
4
dist/count-down/index.wxml
vendored
Normal file
4
dist/count-down/index.wxml
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<view class="van-count-down">
|
||||||
|
<slot wx:if="{{ useSlot }}"/>
|
||||||
|
<block wx:else>{{ formattedTime }}</block>
|
||||||
|
</view>
|
1
dist/count-down/index.wxss
vendored
Normal file
1
dist/count-down/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
@import '../common/index.wxss';.van-count-down{color:#333;font-size:14px;line-height:20px}
|
10
dist/count-down/utils.d.ts
vendored
Normal file
10
dist/count-down/utils.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
export declare type TimeData = {
|
||||||
|
days: number;
|
||||||
|
hours: number;
|
||||||
|
minutes: number;
|
||||||
|
seconds: number;
|
||||||
|
milliseconds: number;
|
||||||
|
};
|
||||||
|
export declare function parseTimeData(time: number): TimeData;
|
||||||
|
export declare function parseFormat(format: string, timeData: TimeData): string;
|
||||||
|
export declare function isSameSecond(time1: number, time2: number): boolean;
|
57
dist/count-down/utils.js
vendored
Normal file
57
dist/count-down/utils.js
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
function padZero(num, targetLength = 2) {
|
||||||
|
let str = num + '';
|
||||||
|
while (str.length < targetLength) {
|
||||||
|
str = '0' + str;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
const SECOND = 1000;
|
||||||
|
const MINUTE = 60 * SECOND;
|
||||||
|
const HOUR = 60 * MINUTE;
|
||||||
|
const DAY = 24 * HOUR;
|
||||||
|
export function parseTimeData(time) {
|
||||||
|
const days = Math.floor(time / DAY);
|
||||||
|
const hours = Math.floor((time % DAY) / HOUR);
|
||||||
|
const minutes = Math.floor((time % HOUR) / MINUTE);
|
||||||
|
const seconds = Math.floor((time % MINUTE) / SECOND);
|
||||||
|
const milliseconds = Math.floor(time % SECOND);
|
||||||
|
return {
|
||||||
|
days,
|
||||||
|
hours,
|
||||||
|
minutes,
|
||||||
|
seconds,
|
||||||
|
milliseconds
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export function parseFormat(format, timeData) {
|
||||||
|
const { days } = timeData;
|
||||||
|
let { hours, minutes, seconds, milliseconds } = timeData;
|
||||||
|
if (format.indexOf('DD') === -1) {
|
||||||
|
hours += days * 24;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
format = format.replace('DD', padZero(days));
|
||||||
|
}
|
||||||
|
if (format.indexOf('HH') === -1) {
|
||||||
|
minutes += hours * 60;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
format = format.replace('HH', padZero(hours));
|
||||||
|
}
|
||||||
|
if (format.indexOf('mm') === -1) {
|
||||||
|
seconds += minutes * 60;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
format = format.replace('mm', padZero(minutes));
|
||||||
|
}
|
||||||
|
if (format.indexOf('ss') === -1) {
|
||||||
|
milliseconds += seconds * 1000;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
format = format.replace('ss', padZero(seconds));
|
||||||
|
}
|
||||||
|
return format.replace('SSS', padZero(milliseconds, 3));
|
||||||
|
}
|
||||||
|
export function isSameSecond(time1, time2) {
|
||||||
|
return Math.floor(time1 / 1000) === Math.floor(time2 / 1000);
|
||||||
|
}
|
2
dist/dialog/dialog.d.ts
vendored
2
dist/dialog/dialog.d.ts
vendored
@ -4,6 +4,7 @@ declare type DialogOptions = {
|
|||||||
lang?: string;
|
lang?: string;
|
||||||
show?: boolean;
|
show?: boolean;
|
||||||
title?: string;
|
title?: string;
|
||||||
|
width?: string | number;
|
||||||
zIndex?: number;
|
zIndex?: number;
|
||||||
context?: WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
|
context?: WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
|
||||||
message?: string;
|
message?: string;
|
||||||
@ -16,6 +17,7 @@ declare type DialogOptions = {
|
|||||||
asyncClose?: boolean;
|
asyncClose?: boolean;
|
||||||
businessId?: number;
|
businessId?: number;
|
||||||
sessionFrom?: string;
|
sessionFrom?: string;
|
||||||
|
overlayStyle?: string;
|
||||||
appParameter?: string;
|
appParameter?: string;
|
||||||
messageAlign?: string;
|
messageAlign?: string;
|
||||||
sendMessageImg?: string;
|
sendMessageImg?: string;
|
||||||
|
12
dist/dialog/dialog.js
vendored
12
dist/dialog/dialog.js
vendored
@ -22,15 +22,17 @@ const Dialog = options => {
|
|||||||
Dialog.defaultOptions = {
|
Dialog.defaultOptions = {
|
||||||
show: true,
|
show: true,
|
||||||
title: '',
|
title: '',
|
||||||
|
width: null,
|
||||||
message: '',
|
message: '',
|
||||||
zIndex: 100,
|
zIndex: 100,
|
||||||
overlay: true,
|
overlay: true,
|
||||||
className: '',
|
|
||||||
customStyle: '',
|
|
||||||
asyncClose: false,
|
|
||||||
messageAlign: '',
|
|
||||||
transition: 'scale',
|
|
||||||
selector: '#van-dialog',
|
selector: '#van-dialog',
|
||||||
|
className: '',
|
||||||
|
asyncClose: false,
|
||||||
|
transition: 'scale',
|
||||||
|
customStyle: '',
|
||||||
|
messageAlign: '',
|
||||||
|
overlayStyle: '',
|
||||||
confirmButtonText: '确认',
|
confirmButtonText: '确认',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
showConfirmButton: true,
|
showConfirmButton: true,
|
||||||
|
11
dist/dialog/index.js
vendored
11
dist/dialog/index.js
vendored
@ -1,6 +1,7 @@
|
|||||||
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],
|
||||||
@ -13,10 +14,15 @@ VantComponent({
|
|||||||
customStyle: String,
|
customStyle: String,
|
||||||
asyncClose: Boolean,
|
asyncClose: Boolean,
|
||||||
messageAlign: String,
|
messageAlign: String,
|
||||||
|
overlayStyle: String,
|
||||||
useTitleSlot: Boolean,
|
useTitleSlot: Boolean,
|
||||||
showCancelButton: Boolean,
|
showCancelButton: Boolean,
|
||||||
closeOnClickOverlay: Boolean,
|
closeOnClickOverlay: Boolean,
|
||||||
confirmButtonOpenType: String,
|
confirmButtonOpenType: String,
|
||||||
|
width: {
|
||||||
|
type: null,
|
||||||
|
observer: 'setWidthWithUnit'
|
||||||
|
},
|
||||||
zIndex: {
|
zIndex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
value: 2000
|
value: 2000
|
||||||
@ -103,6 +109,11 @@ VantComponent({
|
|||||||
if (callback) {
|
if (callback) {
|
||||||
callback(this);
|
callback(this);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
setWidthWithUnit(val) {
|
||||||
|
this.setData({
|
||||||
|
widthWithUnit: addUnit(val)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
5
dist/dialog/index.wxml
vendored
5
dist/dialog/index.wxml
vendored
@ -2,9 +2,10 @@
|
|||||||
show="{{ show }}"
|
show="{{ show }}"
|
||||||
z-index="{{ zIndex }}"
|
z-index="{{ zIndex }}"
|
||||||
overlay="{{ overlay }}"
|
overlay="{{ overlay }}"
|
||||||
custom-class="van-dialog {{ className }}"
|
|
||||||
transition="{{ transition }}"
|
transition="{{ transition }}"
|
||||||
custom-style="{{ customStyle }}"
|
custom-class="van-dialog {{ className }}"
|
||||||
|
custom-style="{{ widthWithUnit ? 'width: ' + widthWithUnit + ';' : '' }}{{ customStyle }}"
|
||||||
|
overlay-style="{{ overlayStyle }}"
|
||||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||||
bind:close="onClickOverlay"
|
bind:close="onClickOverlay"
|
||||||
>
|
>
|
||||||
|
2
dist/dialog/index.wxss
vendored
2
dist/dialog/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-dialog{top:45%!important;width:85%;overflow:hidden;font-size:16px;border-radius:4px;background-color:#fff;background-color:var(--white,#fff)}.van-dialog__header{padding-top:25px;font-weight:500;line-height:24px;text-align:center}.van-dialog__header--isolated{padding:25px 0}.van-dialog__message{max-height:60vh;padding:25px;overflow-y:auto;font-size:14px;line-height:20px;text-align:center;-webkit-overflow-scrolling:touch}.van-dialog__message-text{word-wrap:break-word}.van-dialog__message--has-title{padding-top:12px;color:#7d7e80;color:var(--gray-darker,#7d7e80)}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.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-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}
|
@import '../common/index.wxss';.van-dialog{top:45%!important;width:320px;overflow:hidden;font-size:16px;border-radius:4px;background-color:#fff;background-color:var(--white,#fff)}@media (max-width:321px){.van-dialog{width:90%}}.van-dialog__header{padding-top:25px;font-weight:500;line-height:24px;text-align:center}.van-dialog__header--isolated{padding:25px 0}.van-dialog__message{max-height:60vh;padding:25px;overflow-y:auto;font-size:14px;line-height:20px;text-align:center;-webkit-overflow-scrolling:touch}.van-dialog__message-text{word-wrap:break-word}.van-dialog__message--has-title{padding-top:12px;color:#7d7e80;color:var(--gray-darker,#7d7e80)}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.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-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}
|
15
dist/loading/index.js
vendored
15
dist/loading/index.js
vendored
@ -13,16 +13,27 @@ VantComponent({
|
|||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
value: '#c9c9c9'
|
value: '#c9c9c9'
|
||||||
}
|
},
|
||||||
|
textSize: {
|
||||||
|
type: String,
|
||||||
|
observer: 'setTextSizeWithUnit'
|
||||||
|
},
|
||||||
|
vertical: Boolean
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
sizeWithUnit: '30px'
|
sizeWithUnit: '30px',
|
||||||
|
textSizeWithUnit: '14px'
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setSizeWithUnit(size) {
|
setSizeWithUnit(size) {
|
||||||
this.setData({
|
this.setData({
|
||||||
sizeWithUnit: addUnit(size)
|
sizeWithUnit: addUnit(size)
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
setTextSizeWithUnit(size) {
|
||||||
|
this.set({
|
||||||
|
textSizeWithUnit: addUnit(size)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
30
dist/loading/index.wxml
vendored
30
dist/loading/index.wxml
vendored
@ -1,16 +1,24 @@
|
|||||||
<view
|
<view class="van-loading {{vertical ? 'van-loading--vertical' : ''}}">
|
||||||
class="van-loading custom-class"
|
|
||||||
style="width: {{ sizeWithUnit }}; height: {{ sizeWithUnit }}"
|
|
||||||
>
|
|
||||||
<view
|
<view
|
||||||
class="van-loading__spinner van-loading__spinner--{{ type }}"
|
class="van-loading__wrapper custom-class"
|
||||||
style="color: {{ color }};"
|
style="width: {{ sizeWithUnit }}; height: {{ sizeWithUnit }}"
|
||||||
>
|
>
|
||||||
<view
|
<view
|
||||||
wx:if="{{ type === 'spinner' }}"
|
class="van-loading__spinner van-loading__spinner--{{ type }}"
|
||||||
wx:for="item in 12"
|
style="color: {{ color }};"
|
||||||
wx:key="index"
|
>
|
||||||
class="van-loading__dot"
|
<view
|
||||||
/>
|
wx:if="{{ type === 'spinner' }}"
|
||||||
|
wx:for="item in 12"
|
||||||
|
wx:key="index"
|
||||||
|
class="van-loading__dot"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
style="font-size: {{textSizeWithUnit}};"
|
||||||
|
class="van-loading__text {{vertical ? 'van-loading__text--vertical' : ''}}"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
2
dist/loading/index.wxss
vendored
2
dist/loading/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-loading{z-index:0;line-height:0;vertical-align:middle}.van-loading,.van-loading__spinner{position:relative;display:inline-block}.van-loading__spinner{z-index:-1;box-sizing:border-box;width:100%;height:100%;-webkit-animation:van-rotate .8s linear infinite;animation:van-rotate .8s linear infinite}.van-loading__spinner--spinner{-webkit-animation-timing-function:steps(12);animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-top-color:initial;border-radius:100%}.van-loading__dot{position:absolute;top:0;left:0;width:100%;height:100%}.van-loading__dot:before{display:block;width:2px;height:25%;margin:0 auto;background-color:currentColor;border-radius:40%;content:" "}.van-loading__dot:first-of-type{-webkit-transform:rotate(30deg);transform:rotate(30deg);opacity:1}.van-loading__dot:nth-of-type(2){-webkit-transform:rotate(60deg);transform:rotate(60deg);opacity:.9375}.van-loading__dot:nth-of-type(3){-webkit-transform:rotate(90deg);transform:rotate(90deg);opacity:.875}.van-loading__dot:nth-of-type(4){-webkit-transform:rotate(120deg);transform:rotate(120deg);opacity:.8125}.van-loading__dot:nth-of-type(5){-webkit-transform:rotate(150deg);transform:rotate(150deg);opacity:.75}.van-loading__dot:nth-of-type(6){-webkit-transform:rotate(180deg);transform:rotate(180deg);opacity:.6875}.van-loading__dot:nth-of-type(7){-webkit-transform:rotate(210deg);transform:rotate(210deg);opacity:.625}.van-loading__dot:nth-of-type(8){-webkit-transform:rotate(240deg);transform:rotate(240deg);opacity:.5625}.van-loading__dot:nth-of-type(9){-webkit-transform:rotate(270deg);transform:rotate(270deg);opacity:.5}.van-loading__dot:nth-of-type(10){-webkit-transform:rotate(300deg);transform:rotate(300deg);opacity:.4375}.van-loading__dot:nth-of-type(11){-webkit-transform:rotate(330deg);transform:rotate(330deg);opacity:.375}.van-loading__dot:nth-of-type(12){-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:.3125}@-webkit-keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}
|
@import '../common/index.wxss';.van-loading{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-loading__wrapper{position:relative;z-index:0;display:inline-block;line-height:0}.van-loading--vertical{-webkit-flex-direction:column;flex-direction:column}.van-loading__spinner{position:relative;z-index:-1;display:inline-block;box-sizing:border-box;width:100%;height:100%;-webkit-animation:van-rotate .8s linear infinite;animation:van-rotate .8s linear infinite}.van-loading__spinner--spinner{-webkit-animation-timing-function:steps(12);animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-top-color:initial;border-radius:100%}.van-loading__text{margin-left:8px;color:#969799}.van-loading__text--vertical{margin:8px 0 0}.van-loading__dot{position:absolute;top:0;left:0;width:100%;height:100%}.van-loading__dot:before{display:block;width:2px;height:25%;margin:0 auto;background-color:currentColor;border-radius:40%;content:" "}.van-loading__dot:first-of-type{-webkit-transform:rotate(30deg);transform:rotate(30deg);opacity:1}.van-loading__dot:nth-of-type(2){-webkit-transform:rotate(60deg);transform:rotate(60deg);opacity:.9375}.van-loading__dot:nth-of-type(3){-webkit-transform:rotate(90deg);transform:rotate(90deg);opacity:.875}.van-loading__dot:nth-of-type(4){-webkit-transform:rotate(120deg);transform:rotate(120deg);opacity:.8125}.van-loading__dot:nth-of-type(5){-webkit-transform:rotate(150deg);transform:rotate(150deg);opacity:.75}.van-loading__dot:nth-of-type(6){-webkit-transform:rotate(180deg);transform:rotate(180deg);opacity:.6875}.van-loading__dot:nth-of-type(7){-webkit-transform:rotate(210deg);transform:rotate(210deg);opacity:.625}.van-loading__dot:nth-of-type(8){-webkit-transform:rotate(240deg);transform:rotate(240deg);opacity:.5625}.van-loading__dot:nth-of-type(9){-webkit-transform:rotate(270deg);transform:rotate(270deg);opacity:.5}.van-loading__dot:nth-of-type(10){-webkit-transform:rotate(300deg);transform:rotate(300deg);opacity:.4375}.van-loading__dot:nth-of-type(11){-webkit-transform:rotate(330deg);transform:rotate(330deg);opacity:.375}.van-loading__dot:nth-of-type(12){-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:.3125}@-webkit-keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}
|
29
dist/mixins/transition.js
vendored
29
dist/mixins/transition.js
vendored
@ -39,22 +39,19 @@ export const transition = function (showDefaultValue) {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
observeShow(value) {
|
observeShow(value) {
|
||||||
if (value) {
|
value ? this.enter() : this.leave();
|
||||||
this.enter();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.leave();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
enter() {
|
enter() {
|
||||||
const { duration, name } = this.data;
|
const { duration, name } = this.data;
|
||||||
const classNames = getClassNames(name);
|
const classNames = getClassNames(name);
|
||||||
const currentDuration = isObj(duration) ? duration.enter : duration;
|
const currentDuration = isObj(duration) ? duration.enter : duration;
|
||||||
this.status = 'enter';
|
this.status = 'enter';
|
||||||
|
this.$emit('before-enter');
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.checkStatus('enter');
|
this.checkStatus('enter');
|
||||||
|
this.$emit('enter');
|
||||||
this.setData({
|
this.setData({
|
||||||
inited: true,
|
inited: true,
|
||||||
display: true,
|
display: true,
|
||||||
@ -65,6 +62,7 @@ export const transition = function (showDefaultValue) {
|
|||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.checkStatus('enter');
|
this.checkStatus('enter');
|
||||||
|
this.transitionEnded = false;
|
||||||
this.setData({
|
this.setData({
|
||||||
classes: classNames['enter-to']
|
classes: classNames['enter-to']
|
||||||
});
|
});
|
||||||
@ -72,23 +70,29 @@ export const transition = function (showDefaultValue) {
|
|||||||
.catch(() => { });
|
.catch(() => { });
|
||||||
},
|
},
|
||||||
leave() {
|
leave() {
|
||||||
|
if (!this.data.display) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const { duration, name } = this.data;
|
const { duration, name } = this.data;
|
||||||
const classNames = getClassNames(name);
|
const classNames = getClassNames(name);
|
||||||
const currentDuration = isObj(duration) ? duration.leave : duration;
|
const currentDuration = isObj(duration) ? duration.leave : duration;
|
||||||
this.status = 'leave';
|
this.status = 'leave';
|
||||||
|
this.$emit('before-leave');
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.checkStatus('leave');
|
this.checkStatus('leave');
|
||||||
|
this.$emit('leave');
|
||||||
this.setData({
|
this.setData({
|
||||||
classes: classNames.leave,
|
classes: classNames.leave,
|
||||||
currentDuration
|
currentDuration
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => setTimeout(() => this.onTransitionEnd(), currentDuration))
|
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.checkStatus('leave');
|
this.checkStatus('leave');
|
||||||
|
this.transitionEnded = false;
|
||||||
|
setTimeout(() => this.onTransitionEnd(), currentDuration);
|
||||||
this.setData({
|
this.setData({
|
||||||
classes: classNames['leave-to']
|
classes: classNames['leave-to']
|
||||||
});
|
});
|
||||||
@ -101,9 +105,14 @@ export const transition = function (showDefaultValue) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTransitionEnd() {
|
onTransitionEnd() {
|
||||||
if (!this.data.show) {
|
if (this.transitionEnded) {
|
||||||
this.set({ display: false });
|
return;
|
||||||
this.$emit('transitionend');
|
}
|
||||||
|
this.transitionEnded = true;
|
||||||
|
this.$emit(`after-${this.status}`);
|
||||||
|
const { show, display } = this.data;
|
||||||
|
if (!show && display) {
|
||||||
|
this.setData({ display: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
dist/nav-bar/index.js
vendored
7
dist/nav-bar/index.js
vendored
@ -20,6 +20,13 @@ VantComponent({
|
|||||||
value: true
|
value: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
statusBarHeight: 0
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
const { statusBarHeight } = wx.getSystemInfoSync();
|
||||||
|
this.setData({ statusBarHeight });
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onClickLeft() {
|
onClickLeft() {
|
||||||
this.$emit('click-left');
|
this.$emit('click-left');
|
||||||
|
4
dist/nav-bar/index.wxml
vendored
4
dist/nav-bar/index.wxml
vendored
@ -1,8 +1,8 @@
|
|||||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||||
|
|
||||||
<view
|
<view
|
||||||
class="{{ utils.bem('nav-bar', { fixed, safe: safeAreaInsetTop }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}"
|
class="{{ utils.bem('nav-bar', { fixed }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}"
|
||||||
style="z-index: {{ zIndex }};"
|
style="z-index: {{ zIndex }}; padding-top: {{ safeAreaInsetTop ? statusBarHeight : 0 }}px;"
|
||||||
>
|
>
|
||||||
<view class="van-nav-bar__left" bind:tap="onClickLeft">
|
<view class="van-nav-bar__left" bind:tap="onClickLeft">
|
||||||
<block wx:if="{{ leftArrow || leftText }}">
|
<block wx:if="{{ leftArrow || leftText }}">
|
||||||
|
2
dist/nav-bar/index.wxss
vendored
2
dist/nav-bar/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--white,#fff)}.van-nav-bar--safe{padding-top:env(safe-area-inset-top)}.van-nav-bar__text{display:inline-block;margin:0 -15px;padding:0 15px;vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-weight:500;font-size:16px}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}
|
@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--white,#fff)}.van-nav-bar__text{display:inline-block;margin:0 -15px;padding:0 15px;vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-weight:500;font-size:16px}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}
|
2
dist/rate/index.wxss
vendored
2
dist/rate/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-rate{display:inline-block;-webkit-user-select:none;user-select:none}.van-rate__item{position:relative;display:inline-block;padding:0 2px;padding:0 var(--rate-horizontal-padding,2px)}.van-rate__icon{display:block;height:1em}.van-rate__icon--half{position:absolute;top:0;width:.5em;overflow:hidden;left:2px;left:var(--rate-horizontal-padding,2px)}
|
@import '../common/index.wxss';.van-rate{display:-webkit-inline-flex;display:inline-flex;-webkit-user-select:none;user-select:none}.van-rate__item{position:relative;padding:0 2px;padding:0 var(--rate-horizontal-padding,2px)}.van-rate__icon{display:block;height:1em}.van-rate__icon--half{position:absolute;top:0;width:.5em;overflow:hidden;left:2px;left:var(--rate-horizontal-padding,2px)}
|
6
dist/slider/index.js
vendored
6
dist/slider/index.js
vendored
@ -82,7 +82,11 @@ VantComponent({
|
|||||||
const width = `${((value - min) * 100) / this.getRange()}%`;
|
const width = `${((value - min) * 100) / this.getRange()}%`;
|
||||||
this.setData({
|
this.setData({
|
||||||
value,
|
value,
|
||||||
barStyle: `width: ${width}; height: ${addUnit(barHeight)};`
|
barStyle: `
|
||||||
|
width: ${width};
|
||||||
|
height: ${addUnit(barHeight)};
|
||||||
|
${drag ? 'transition: none;' : ''}
|
||||||
|
`,
|
||||||
});
|
});
|
||||||
if (drag) {
|
if (drag) {
|
||||||
this.$emit('drag', { value });
|
this.$emit('drag', { value });
|
||||||
|
2
dist/slider/index.wxss
vendored
2
dist/slider/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-slider{position:relative;border-radius:999px;background-color:#e5e5e5;background-color:var(--gray-light,#e5e5e5)}.van-slider__bar{position:relative;border-radius:inherit;background-color:#1989fa;background-color:var(--blue,#1989fa)}.van-slider__button{width:20px;height:20px;border-radius:50%;box-shadow:0 1px 2px rgba(0,0,0,.5);background-color:#fff;background-color:var(--white,#fff)}.van-slider__button-wrapper{position:absolute;top:50%;right:0;-webkit-transform:translate3d(50%,-50%,0);transform:translate3d(50%,-50%,0)}.van-slider__button-wrapper:after{position:absolute;top:-50%;left:-50%;width:200%;height:200%;content:""}.van-slider--disabled{opacity:.3}
|
@import '../common/index.wxss';.van-slider{position:relative;border-radius:999px;background-color:#e5e5e5;background-color:var(--gray-light,#e5e5e5)}.van-slider:before{position:absolute;top:-8px;right:0;bottom:-8px;left:0;content:""}.van-slider__bar{position:relative;border-radius:inherit;transition:width .2s;background-color:#1989fa;background-color:var(--blue,#1989fa)}.van-slider__button{width:24px;height:24px;border-radius:50%;box-shadow:0 1px 2px rgba(0,0,0,.5);background-color:#fff;background-color:var(--white,#fff)}.van-slider__button-wrapper{position:absolute;top:50%;right:0;-webkit-transform:translate3d(50%,-50%,0);transform:translate3d(50%,-50%,0)}.van-slider--disabled{opacity:.3}
|
15
dist/stepper/index.js
vendored
15
dist/stepper/index.js
vendored
@ -2,6 +2,11 @@ import { VantComponent } from '../common/component';
|
|||||||
import { addUnit, isDef } from '../common/utils';
|
import { addUnit, isDef } from '../common/utils';
|
||||||
const LONG_PRESS_START_TIME = 600;
|
const LONG_PRESS_START_TIME = 600;
|
||||||
const LONG_PRESS_INTERVAL = 200;
|
const LONG_PRESS_INTERVAL = 200;
|
||||||
|
// add num and avoid float number
|
||||||
|
function add(num1, num2) {
|
||||||
|
const cardinal = Math.pow(10, 10);
|
||||||
|
return Math.round((num1 + num2) * cardinal) / cardinal;
|
||||||
|
}
|
||||||
VantComponent({
|
VantComponent({
|
||||||
field: true,
|
field: true,
|
||||||
classes: ['input-class', 'plus-class', 'minus-class'],
|
classes: ['input-class', 'plus-class', 'minus-class'],
|
||||||
@ -13,7 +18,10 @@ VantComponent({
|
|||||||
buttonSize: null,
|
buttonSize: null,
|
||||||
asyncChange: Boolean,
|
asyncChange: Boolean,
|
||||||
disableInput: Boolean,
|
disableInput: Boolean,
|
||||||
decimalLength: Number,
|
decimalLength: {
|
||||||
|
type: Number,
|
||||||
|
value: null
|
||||||
|
},
|
||||||
min: {
|
min: {
|
||||||
type: null,
|
type: null,
|
||||||
value: 1
|
value: 1
|
||||||
@ -105,10 +113,7 @@ VantComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const diff = type === 'minus' ? -this.data.step : +this.data.step;
|
const diff = type === 'minus' ? -this.data.step : +this.data.step;
|
||||||
let value = +this.data.value + diff;
|
const value = add(+this.data.value, diff);
|
||||||
if (!isDef(this.data.decimalLength)) {
|
|
||||||
value = Math.round(value * 100) / 100;
|
|
||||||
}
|
|
||||||
this.triggerInput(this.range(value));
|
this.triggerInput(this.range(value));
|
||||||
this.$emit(type);
|
this.$emit(type);
|
||||||
},
|
},
|
||||||
|
4
dist/tabs/index.js
vendored
4
dist/tabs/index.js
vendored
@ -78,7 +78,7 @@ VantComponent({
|
|||||||
trackStyle: '',
|
trackStyle: '',
|
||||||
wrapStyle: '',
|
wrapStyle: '',
|
||||||
position: '',
|
position: '',
|
||||||
currentIndex: null,
|
currentIndex: 0,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
swipeThreshold() {
|
swipeThreshold() {
|
||||||
@ -194,7 +194,7 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
setActiveTab() {
|
setActiveTab() {
|
||||||
if (!isDef(this.currentName)) {
|
if (!isDef(this.currentName)) {
|
||||||
this.currentName = this.data.active || this.children[0].computedName;
|
this.currentName = this.data.active || (this.children[0] || {}).computedName;
|
||||||
}
|
}
|
||||||
this.children.forEach((item, index) => {
|
this.children.forEach((item, index) => {
|
||||||
const data = {
|
const data = {
|
||||||
|
@ -6,6 +6,7 @@ component_1.VantComponent({
|
|||||||
show: Boolean,
|
show: Boolean,
|
||||||
title: String,
|
title: String,
|
||||||
cancelText: String,
|
cancelText: String,
|
||||||
|
description: String,
|
||||||
round: {
|
round: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true
|
value: true
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
bind:click="onClose"
|
bind:click="onClose"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
<view wx:if="{{ description }}" class="van-action-sheet__description">
|
||||||
|
{{ description }}
|
||||||
|
</view>
|
||||||
<view wx:if="{{ actions && actions.length }}">
|
<view wx:if="{{ actions && actions.length }}">
|
||||||
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
|
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
|
||||||
<button
|
<button
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;color:#333;color:var(--text-color,#333)}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;font-size:16px;line-height:50px;text-align:center;background-color:#fff;background-color:var(--white,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel{height:60px}.van-action-sheet__cancel:before{display:block;height:10px;content:" ";background-color:#f8f8f8;background-color:var(--background-color,#f8f8f8)}.van-action-sheet__item--disabled{color:#c9c9c9;color:var(--gray,#c9c9c9)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--white,#fff)}.van-action-sheet__subname{margin-left:5px;font-size:12px;color:#7d7e80;color:var(--gray-darker,#7d7e80)}.van-action-sheet__header{font-weight:500;font-size:16px;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;color:var(--gray-dark,#999)}
|
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;color:#333;color:var(--text-color,#333)}.van-action-sheet__cancel,.van-action-sheet__item{height:50px;font-size:16px;line-height:50px;text-align:center;background-color:#fff;background-color:var(--white,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel{height:60px}.van-action-sheet__cancel:before{display:block;height:10px;content:" ";background-color:#f8f8f8;background-color:var(--background-color,#f8f8f8)}.van-action-sheet__item--disabled{color:#c9c9c9;color:var(--gray,#c9c9c9)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--white,#fff)}.van-action-sheet__subname{margin-left:5px;font-size:12px;color:#7d7e80;color:var(--gray-darker,#7d7e80)}.van-action-sheet__header{font-weight:500;font-size:16px;line-height:44px;text-align:center}.van-action-sheet__description{padding:16px;color:#7d7e80;font-size:14px;line-height:20px;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;color:var(--gray-dark,#999)}
|
@ -13,6 +13,7 @@ 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 shared_1 = require("../picker/shared");
|
var shared_1 = require("../picker/shared");
|
||||||
|
var COLUMNSPLACEHOLDERCODE = '000000';
|
||||||
component_1.VantComponent({
|
component_1.VantComponent({
|
||||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||||
props: __assign(__assign({}, shared_1.pickerProps), { value: String, areaList: {
|
props: __assign(__assign({}, shared_1.pickerProps), { value: String, areaList: {
|
||||||
@ -21,10 +22,22 @@ component_1.VantComponent({
|
|||||||
}, columnsNum: {
|
}, columnsNum: {
|
||||||
type: null,
|
type: null,
|
||||||
value: 3
|
value: 3
|
||||||
|
}, columnsPlaceholder: {
|
||||||
|
type: Array,
|
||||||
|
observer: function (val) {
|
||||||
|
this.setData({
|
||||||
|
typeToColumnsPlaceholder: {
|
||||||
|
province: val[0] || '',
|
||||||
|
city: val[1] || '',
|
||||||
|
county: val[2] || '',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} }),
|
} }),
|
||||||
data: {
|
data: {
|
||||||
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||||
displayColumns: [{ values: [] }, { values: [] }, { values: [] }]
|
displayColumns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||||
|
typeToColumnsPlaceholder: {}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value: function (value) {
|
value: function (value) {
|
||||||
@ -55,21 +68,39 @@ component_1.VantComponent({
|
|||||||
this.emit('cancel', event.detail);
|
this.emit('cancel', event.detail);
|
||||||
},
|
},
|
||||||
onConfirm: function (event) {
|
onConfirm: function (event) {
|
||||||
this.emit('confirm', event.detail);
|
var index = event.detail.index;
|
||||||
|
var value = event.detail.value;
|
||||||
|
value = this.parseOutputValues(value);
|
||||||
|
this.emit('confirm', { value: value, index: index });
|
||||||
},
|
},
|
||||||
emit: function (type, detail) {
|
emit: function (type, detail) {
|
||||||
detail.values = detail.value;
|
detail.values = detail.value;
|
||||||
delete detail.value;
|
delete detail.value;
|
||||||
this.$emit(type, detail);
|
this.$emit(type, detail);
|
||||||
},
|
},
|
||||||
|
// parse output columns data
|
||||||
|
parseOutputValues: function (values) {
|
||||||
|
var columnsPlaceholder = this.data.columnsPlaceholder;
|
||||||
|
return values.map(function (value, index) {
|
||||||
|
if (value === void 0) { value = {}; }
|
||||||
|
value = JSON.parse(JSON.stringify(value));
|
||||||
|
if (!value.code || value.name === columnsPlaceholder[index]) {
|
||||||
|
value.code = '';
|
||||||
|
value.name = '';
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
},
|
||||||
onChange: function (event) {
|
onChange: function (event) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
var _a = event.detail, index = _a.index, picker = _a.picker, value = _a.value;
|
var _a = event.detail, index = _a.index, picker = _a.picker, value = _a.value;
|
||||||
this.code = value[index].code;
|
this.code = value[index].code;
|
||||||
|
var getValues = picker.getValues();
|
||||||
|
getValues = this.parseOutputValues(getValues);
|
||||||
this.setValues().then(function () {
|
this.setValues().then(function () {
|
||||||
_this.$emit('change', {
|
_this.$emit('change', {
|
||||||
picker: picker,
|
picker: picker,
|
||||||
values: picker.getValues(),
|
values: getValues,
|
||||||
index: index
|
index: index
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -79,6 +110,7 @@ component_1.VantComponent({
|
|||||||
return (areaList && areaList[type + "_list"]) || {};
|
return (areaList && areaList[type + "_list"]) || {};
|
||||||
},
|
},
|
||||||
getList: function (type, code) {
|
getList: function (type, code) {
|
||||||
|
var typeToColumnsPlaceholder = this.data.typeToColumnsPlaceholder;
|
||||||
var result = [];
|
var result = [];
|
||||||
if (type !== 'province' && !code) {
|
if (type !== 'province' && !code) {
|
||||||
return result;
|
return result;
|
||||||
@ -95,6 +127,14 @@ component_1.VantComponent({
|
|||||||
}
|
}
|
||||||
result = result.filter(function (item) { return item.code.indexOf(code) === 0; });
|
result = result.filter(function (item) { return item.code.indexOf(code) === 0; });
|
||||||
}
|
}
|
||||||
|
if (typeToColumnsPlaceholder[type] && result.length) {
|
||||||
|
// set columns placeholder
|
||||||
|
var codeFill = type === 'province' ? '' : type === 'city' ? COLUMNSPLACEHOLDERCODE.slice(2, 4) : COLUMNSPLACEHOLDERCODE.slice(4, 6);
|
||||||
|
result.unshift({
|
||||||
|
code: "" + code + codeFill,
|
||||||
|
name: typeToColumnsPlaceholder[type]
|
||||||
|
});
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
getIndex: function (type, code) {
|
getIndex: function (type, code) {
|
||||||
@ -115,7 +155,18 @@ component_1.VantComponent({
|
|||||||
setValues: function () {
|
setValues: function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
var county = this.getConfig('county');
|
var county = this.getConfig('county');
|
||||||
var code = this.code || Object.keys(county)[0] || '';
|
var code = this.code;
|
||||||
|
if (!code) {
|
||||||
|
if (this.data.columnsPlaceholder.length) {
|
||||||
|
code = COLUMNSPLACEHOLDERCODE;
|
||||||
|
}
|
||||||
|
else if (Object.keys(county)[0]) {
|
||||||
|
code = Object.keys(county)[0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
code = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
var province = this.getList('province');
|
var province = this.getList('province');
|
||||||
var city = this.getList('city', code.slice(0, 2));
|
var city = this.getList('city', code.slice(0, 2));
|
||||||
var picker = this.getPicker();
|
var picker = this.getPicker();
|
||||||
|
100
lib/count-down/index.js
Normal file
100
lib/count-down/index.js
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var component_1 = require("../common/component");
|
||||||
|
var utils_1 = require("./utils");
|
||||||
|
function simpleTick(fn) {
|
||||||
|
return setTimeout(fn, 30);
|
||||||
|
}
|
||||||
|
component_1.VantComponent({
|
||||||
|
props: {
|
||||||
|
useSlot: Boolean,
|
||||||
|
millisecond: Boolean,
|
||||||
|
time: {
|
||||||
|
type: Number,
|
||||||
|
observer: 'reset'
|
||||||
|
},
|
||||||
|
format: {
|
||||||
|
type: String,
|
||||||
|
value: 'HH:mm:ss'
|
||||||
|
},
|
||||||
|
autoStart: {
|
||||||
|
type: Boolean,
|
||||||
|
value: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
timeData: utils_1.parseTimeData(0),
|
||||||
|
formattedTime: '0'
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 开始
|
||||||
|
start: function () {
|
||||||
|
if (this.counting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.counting = true;
|
||||||
|
this.endTime = Date.now() + this.remain;
|
||||||
|
this.tick();
|
||||||
|
},
|
||||||
|
// 暂停
|
||||||
|
pause: function () {
|
||||||
|
this.counting = false;
|
||||||
|
clearTimeout(this.tid);
|
||||||
|
},
|
||||||
|
// 重置
|
||||||
|
reset: function () {
|
||||||
|
this.pause();
|
||||||
|
this.remain = this.data.time;
|
||||||
|
this.setRemain(this.remain);
|
||||||
|
if (this.data.autoStart) {
|
||||||
|
this.start();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tick: function () {
|
||||||
|
if (this.data.millisecond) {
|
||||||
|
this.microTick();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.macroTick();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
microTick: function () {
|
||||||
|
var _this = this;
|
||||||
|
this.tid = simpleTick(function () {
|
||||||
|
_this.setRemain(_this.getRemain());
|
||||||
|
if (_this.remain !== 0) {
|
||||||
|
_this.microTick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
macroTick: function () {
|
||||||
|
var _this = this;
|
||||||
|
this.tid = simpleTick(function () {
|
||||||
|
var remain = _this.getRemain();
|
||||||
|
if (!utils_1.isSameSecond(remain, _this.remain) || remain === 0) {
|
||||||
|
_this.setRemain(remain);
|
||||||
|
}
|
||||||
|
if (_this.remain !== 0) {
|
||||||
|
_this.macroTick();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getRemain: function () {
|
||||||
|
return Math.max(this.endTime - Date.now(), 0);
|
||||||
|
},
|
||||||
|
setRemain: function (remain) {
|
||||||
|
this.remain = remain;
|
||||||
|
var timeData = utils_1.parseTimeData(remain);
|
||||||
|
if (this.data.useSlot) {
|
||||||
|
this.$emit('change', timeData);
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
formattedTime: utils_1.parseFormat(this.data.format, timeData)
|
||||||
|
});
|
||||||
|
if (remain === 0) {
|
||||||
|
this.pause();
|
||||||
|
this.$emit('finish');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
3
lib/count-down/index.json
Normal file
3
lib/count-down/index.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"component": true
|
||||||
|
}
|
4
lib/count-down/index.wxml
Normal file
4
lib/count-down/index.wxml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<view class="van-count-down">
|
||||||
|
<slot wx:if="{{ useSlot }}"/>
|
||||||
|
<block wx:else>{{ formattedTime }}</block>
|
||||||
|
</view>
|
1
lib/count-down/index.wxss
Normal file
1
lib/count-down/index.wxss
Normal file
@ -0,0 +1 @@
|
|||||||
|
@import '../common/index.wxss';.van-count-down{color:#333;font-size:14px;line-height:20px}
|
63
lib/count-down/utils.js
Normal file
63
lib/count-down/utils.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
function padZero(num, targetLength) {
|
||||||
|
if (targetLength === void 0) { targetLength = 2; }
|
||||||
|
var str = num + '';
|
||||||
|
while (str.length < targetLength) {
|
||||||
|
str = '0' + str;
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
var SECOND = 1000;
|
||||||
|
var MINUTE = 60 * SECOND;
|
||||||
|
var HOUR = 60 * MINUTE;
|
||||||
|
var DAY = 24 * HOUR;
|
||||||
|
function parseTimeData(time) {
|
||||||
|
var days = Math.floor(time / DAY);
|
||||||
|
var hours = Math.floor((time % DAY) / HOUR);
|
||||||
|
var minutes = Math.floor((time % HOUR) / MINUTE);
|
||||||
|
var seconds = Math.floor((time % MINUTE) / SECOND);
|
||||||
|
var milliseconds = Math.floor(time % SECOND);
|
||||||
|
return {
|
||||||
|
days: days,
|
||||||
|
hours: hours,
|
||||||
|
minutes: minutes,
|
||||||
|
seconds: seconds,
|
||||||
|
milliseconds: milliseconds
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports.parseTimeData = parseTimeData;
|
||||||
|
function parseFormat(format, timeData) {
|
||||||
|
var days = timeData.days;
|
||||||
|
var hours = timeData.hours, minutes = timeData.minutes, seconds = timeData.seconds, milliseconds = timeData.milliseconds;
|
||||||
|
if (format.indexOf('DD') === -1) {
|
||||||
|
hours += days * 24;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
format = format.replace('DD', padZero(days));
|
||||||
|
}
|
||||||
|
if (format.indexOf('HH') === -1) {
|
||||||
|
minutes += hours * 60;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
format = format.replace('HH', padZero(hours));
|
||||||
|
}
|
||||||
|
if (format.indexOf('mm') === -1) {
|
||||||
|
seconds += minutes * 60;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
format = format.replace('mm', padZero(minutes));
|
||||||
|
}
|
||||||
|
if (format.indexOf('ss') === -1) {
|
||||||
|
milliseconds += seconds * 1000;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
format = format.replace('ss', padZero(seconds));
|
||||||
|
}
|
||||||
|
return format.replace('SSS', padZero(milliseconds, 3));
|
||||||
|
}
|
||||||
|
exports.parseFormat = parseFormat;
|
||||||
|
function isSameSecond(time1, time2) {
|
||||||
|
return Math.floor(time1 / 1000) === Math.floor(time2 / 1000);
|
||||||
|
}
|
||||||
|
exports.isSameSecond = isSameSecond;
|
@ -35,15 +35,17 @@ var Dialog = function (options) {
|
|||||||
Dialog.defaultOptions = {
|
Dialog.defaultOptions = {
|
||||||
show: true,
|
show: true,
|
||||||
title: '',
|
title: '',
|
||||||
|
width: null,
|
||||||
message: '',
|
message: '',
|
||||||
zIndex: 100,
|
zIndex: 100,
|
||||||
overlay: true,
|
overlay: true,
|
||||||
className: '',
|
|
||||||
customStyle: '',
|
|
||||||
asyncClose: false,
|
|
||||||
messageAlign: '',
|
|
||||||
transition: 'scale',
|
|
||||||
selector: '#van-dialog',
|
selector: '#van-dialog',
|
||||||
|
className: '',
|
||||||
|
asyncClose: false,
|
||||||
|
transition: 'scale',
|
||||||
|
customStyle: '',
|
||||||
|
messageAlign: '',
|
||||||
|
overlayStyle: '',
|
||||||
confirmButtonText: '确认',
|
confirmButtonText: '确认',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
showConfirmButton: true,
|
showConfirmButton: true,
|
||||||
|
@ -3,6 +3,7 @@ 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],
|
||||||
@ -15,10 +16,15 @@ component_1.VantComponent({
|
|||||||
customStyle: String,
|
customStyle: String,
|
||||||
asyncClose: Boolean,
|
asyncClose: Boolean,
|
||||||
messageAlign: String,
|
messageAlign: String,
|
||||||
|
overlayStyle: String,
|
||||||
useTitleSlot: Boolean,
|
useTitleSlot: Boolean,
|
||||||
showCancelButton: Boolean,
|
showCancelButton: Boolean,
|
||||||
closeOnClickOverlay: Boolean,
|
closeOnClickOverlay: Boolean,
|
||||||
confirmButtonOpenType: String,
|
confirmButtonOpenType: String,
|
||||||
|
width: {
|
||||||
|
type: null,
|
||||||
|
observer: 'setWidthWithUnit'
|
||||||
|
},
|
||||||
zIndex: {
|
zIndex: {
|
||||||
type: Number,
|
type: Number,
|
||||||
value: 2000
|
value: 2000
|
||||||
@ -106,6 +112,11 @@ component_1.VantComponent({
|
|||||||
if (callback) {
|
if (callback) {
|
||||||
callback(this);
|
callback(this);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
setWidthWithUnit: function (val) {
|
||||||
|
this.setData({
|
||||||
|
widthWithUnit: utils_1.addUnit(val)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
show="{{ show }}"
|
show="{{ show }}"
|
||||||
z-index="{{ zIndex }}"
|
z-index="{{ zIndex }}"
|
||||||
overlay="{{ overlay }}"
|
overlay="{{ overlay }}"
|
||||||
custom-class="van-dialog {{ className }}"
|
|
||||||
transition="{{ transition }}"
|
transition="{{ transition }}"
|
||||||
custom-style="{{ customStyle }}"
|
custom-class="van-dialog {{ className }}"
|
||||||
|
custom-style="{{ widthWithUnit ? 'width: ' + widthWithUnit + ';' : '' }}{{ customStyle }}"
|
||||||
|
overlay-style="{{ overlayStyle }}"
|
||||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||||
bind:close="onClickOverlay"
|
bind:close="onClickOverlay"
|
||||||
>
|
>
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-dialog{top:45%!important;width:85%;overflow:hidden;font-size:16px;border-radius:4px;background-color:#fff;background-color:var(--white,#fff)}.van-dialog__header{padding-top:25px;font-weight:500;line-height:24px;text-align:center}.van-dialog__header--isolated{padding:25px 0}.van-dialog__message{max-height:60vh;padding:25px;overflow-y:auto;font-size:14px;line-height:20px;text-align:center;-webkit-overflow-scrolling:touch}.van-dialog__message-text{word-wrap:break-word}.van-dialog__message--has-title{padding-top:12px;color:#7d7e80;color:var(--gray-darker,#7d7e80)}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.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-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}
|
@import '../common/index.wxss';.van-dialog{top:45%!important;width:320px;overflow:hidden;font-size:16px;border-radius:4px;background-color:#fff;background-color:var(--white,#fff)}@media (max-width:321px){.van-dialog{width:90%}}.van-dialog__header{padding-top:25px;font-weight:500;line-height:24px;text-align:center}.van-dialog__header--isolated{padding:25px 0}.van-dialog__message{max-height:60vh;padding:25px;overflow-y:auto;font-size:14px;line-height:20px;text-align:center;-webkit-overflow-scrolling:touch}.van-dialog__message-text{word-wrap:break-word}.van-dialog__message--has-title{padding-top:12px;color:#7d7e80;color:var(--gray-darker,#7d7e80)}.van-dialog__message--left{text-align:left}.van-dialog__message--right{text-align:right}.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-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.van-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}
|
@ -15,16 +15,27 @@ component_1.VantComponent({
|
|||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
value: '#c9c9c9'
|
value: '#c9c9c9'
|
||||||
}
|
},
|
||||||
|
textSize: {
|
||||||
|
type: String,
|
||||||
|
observer: 'setTextSizeWithUnit'
|
||||||
|
},
|
||||||
|
vertical: Boolean
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
sizeWithUnit: '30px'
|
sizeWithUnit: '30px',
|
||||||
|
textSizeWithUnit: '14px'
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setSizeWithUnit: function (size) {
|
setSizeWithUnit: function (size) {
|
||||||
this.setData({
|
this.setData({
|
||||||
sizeWithUnit: utils_1.addUnit(size)
|
sizeWithUnit: utils_1.addUnit(size)
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
setTextSizeWithUnit: function (size) {
|
||||||
|
this.set({
|
||||||
|
textSizeWithUnit: utils_1.addUnit(size)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,16 +1,24 @@
|
|||||||
<view
|
<view class="van-loading {{vertical ? 'van-loading--vertical' : ''}}">
|
||||||
class="van-loading custom-class"
|
|
||||||
style="width: {{ sizeWithUnit }}; height: {{ sizeWithUnit }}"
|
|
||||||
>
|
|
||||||
<view
|
<view
|
||||||
class="van-loading__spinner van-loading__spinner--{{ type }}"
|
class="van-loading__wrapper custom-class"
|
||||||
style="color: {{ color }};"
|
style="width: {{ sizeWithUnit }}; height: {{ sizeWithUnit }}"
|
||||||
>
|
>
|
||||||
<view
|
<view
|
||||||
wx:if="{{ type === 'spinner' }}"
|
class="van-loading__spinner van-loading__spinner--{{ type }}"
|
||||||
wx:for="item in 12"
|
style="color: {{ color }};"
|
||||||
wx:key="index"
|
>
|
||||||
class="van-loading__dot"
|
<view
|
||||||
/>
|
wx:if="{{ type === 'spinner' }}"
|
||||||
|
wx:for="item in 12"
|
||||||
|
wx:key="index"
|
||||||
|
class="van-loading__dot"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
style="font-size: {{textSizeWithUnit}};"
|
||||||
|
class="van-loading__text {{vertical ? 'van-loading__text--vertical' : ''}}"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-loading{z-index:0;line-height:0;vertical-align:middle}.van-loading,.van-loading__spinner{position:relative;display:inline-block}.van-loading__spinner{z-index:-1;box-sizing:border-box;width:100%;height:100%;-webkit-animation:van-rotate .8s linear infinite;animation:van-rotate .8s linear infinite}.van-loading__spinner--spinner{-webkit-animation-timing-function:steps(12);animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-top-color:initial;border-radius:100%}.van-loading__dot{position:absolute;top:0;left:0;width:100%;height:100%}.van-loading__dot:before{display:block;width:2px;height:25%;margin:0 auto;background-color:currentColor;border-radius:40%;content:" "}.van-loading__dot:first-of-type{-webkit-transform:rotate(30deg);transform:rotate(30deg);opacity:1}.van-loading__dot:nth-of-type(2){-webkit-transform:rotate(60deg);transform:rotate(60deg);opacity:.9375}.van-loading__dot:nth-of-type(3){-webkit-transform:rotate(90deg);transform:rotate(90deg);opacity:.875}.van-loading__dot:nth-of-type(4){-webkit-transform:rotate(120deg);transform:rotate(120deg);opacity:.8125}.van-loading__dot:nth-of-type(5){-webkit-transform:rotate(150deg);transform:rotate(150deg);opacity:.75}.van-loading__dot:nth-of-type(6){-webkit-transform:rotate(180deg);transform:rotate(180deg);opacity:.6875}.van-loading__dot:nth-of-type(7){-webkit-transform:rotate(210deg);transform:rotate(210deg);opacity:.625}.van-loading__dot:nth-of-type(8){-webkit-transform:rotate(240deg);transform:rotate(240deg);opacity:.5625}.van-loading__dot:nth-of-type(9){-webkit-transform:rotate(270deg);transform:rotate(270deg);opacity:.5}.van-loading__dot:nth-of-type(10){-webkit-transform:rotate(300deg);transform:rotate(300deg);opacity:.4375}.van-loading__dot:nth-of-type(11){-webkit-transform:rotate(330deg);transform:rotate(330deg);opacity:.375}.van-loading__dot:nth-of-type(12){-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:.3125}@-webkit-keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}
|
@import '../common/index.wxss';.van-loading{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-loading__wrapper{position:relative;z-index:0;display:inline-block;line-height:0}.van-loading--vertical{-webkit-flex-direction:column;flex-direction:column}.van-loading__spinner{position:relative;z-index:-1;display:inline-block;box-sizing:border-box;width:100%;height:100%;-webkit-animation:van-rotate .8s linear infinite;animation:van-rotate .8s linear infinite}.van-loading__spinner--spinner{-webkit-animation-timing-function:steps(12);animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-top-color:initial;border-radius:100%}.van-loading__text{margin-left:8px;color:#969799}.van-loading__text--vertical{margin:8px 0 0}.van-loading__dot{position:absolute;top:0;left:0;width:100%;height:100%}.van-loading__dot:before{display:block;width:2px;height:25%;margin:0 auto;background-color:currentColor;border-radius:40%;content:" "}.van-loading__dot:first-of-type{-webkit-transform:rotate(30deg);transform:rotate(30deg);opacity:1}.van-loading__dot:nth-of-type(2){-webkit-transform:rotate(60deg);transform:rotate(60deg);opacity:.9375}.van-loading__dot:nth-of-type(3){-webkit-transform:rotate(90deg);transform:rotate(90deg);opacity:.875}.van-loading__dot:nth-of-type(4){-webkit-transform:rotate(120deg);transform:rotate(120deg);opacity:.8125}.van-loading__dot:nth-of-type(5){-webkit-transform:rotate(150deg);transform:rotate(150deg);opacity:.75}.van-loading__dot:nth-of-type(6){-webkit-transform:rotate(180deg);transform:rotate(180deg);opacity:.6875}.van-loading__dot:nth-of-type(7){-webkit-transform:rotate(210deg);transform:rotate(210deg);opacity:.625}.van-loading__dot:nth-of-type(8){-webkit-transform:rotate(240deg);transform:rotate(240deg);opacity:.5625}.van-loading__dot:nth-of-type(9){-webkit-transform:rotate(270deg);transform:rotate(270deg);opacity:.5}.van-loading__dot:nth-of-type(10){-webkit-transform:rotate(300deg);transform:rotate(300deg);opacity:.4375}.van-loading__dot:nth-of-type(11){-webkit-transform:rotate(330deg);transform:rotate(330deg);opacity:.375}.van-loading__dot:nth-of-type(12){-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:.3125}@-webkit-keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}
|
@ -41,12 +41,7 @@ exports.transition = function (showDefaultValue) {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
observeShow: function (value) {
|
observeShow: function (value) {
|
||||||
if (value) {
|
value ? this.enter() : this.leave();
|
||||||
this.enter();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.leave();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
enter: function () {
|
enter: function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
@ -54,10 +49,12 @@ exports.transition = function (showDefaultValue) {
|
|||||||
var classNames = getClassNames(name);
|
var classNames = getClassNames(name);
|
||||||
var currentDuration = utils_1.isObj(duration) ? duration.enter : duration;
|
var currentDuration = utils_1.isObj(duration) ? duration.enter : duration;
|
||||||
this.status = 'enter';
|
this.status = 'enter';
|
||||||
|
this.$emit('before-enter');
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
_this.checkStatus('enter');
|
_this.checkStatus('enter');
|
||||||
|
_this.$emit('enter');
|
||||||
_this.setData({
|
_this.setData({
|
||||||
inited: true,
|
inited: true,
|
||||||
display: true,
|
display: true,
|
||||||
@ -68,6 +65,7 @@ exports.transition = function (showDefaultValue) {
|
|||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
_this.checkStatus('enter');
|
_this.checkStatus('enter');
|
||||||
|
_this.transitionEnded = false;
|
||||||
_this.setData({
|
_this.setData({
|
||||||
classes: classNames['enter-to']
|
classes: classNames['enter-to']
|
||||||
});
|
});
|
||||||
@ -76,23 +74,29 @@ exports.transition = function (showDefaultValue) {
|
|||||||
},
|
},
|
||||||
leave: function () {
|
leave: function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
if (!this.data.display) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var _a = this.data, duration = _a.duration, name = _a.name;
|
var _a = this.data, duration = _a.duration, name = _a.name;
|
||||||
var classNames = getClassNames(name);
|
var classNames = getClassNames(name);
|
||||||
var currentDuration = utils_1.isObj(duration) ? duration.leave : duration;
|
var currentDuration = utils_1.isObj(duration) ? duration.leave : duration;
|
||||||
this.status = 'leave';
|
this.status = 'leave';
|
||||||
|
this.$emit('before-leave');
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
_this.checkStatus('leave');
|
_this.checkStatus('leave');
|
||||||
|
_this.$emit('leave');
|
||||||
_this.setData({
|
_this.setData({
|
||||||
classes: classNames.leave,
|
classes: classNames.leave,
|
||||||
currentDuration: currentDuration
|
currentDuration: currentDuration
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(function () { return setTimeout(function () { return _this.onTransitionEnd(); }, currentDuration); })
|
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
_this.checkStatus('leave');
|
_this.checkStatus('leave');
|
||||||
|
_this.transitionEnded = false;
|
||||||
|
setTimeout(function () { return _this.onTransitionEnd(); }, currentDuration);
|
||||||
_this.setData({
|
_this.setData({
|
||||||
classes: classNames['leave-to']
|
classes: classNames['leave-to']
|
||||||
});
|
});
|
||||||
@ -105,9 +109,14 @@ exports.transition = function (showDefaultValue) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onTransitionEnd: function () {
|
onTransitionEnd: function () {
|
||||||
if (!this.data.show) {
|
if (this.transitionEnded) {
|
||||||
this.set({ display: false });
|
return;
|
||||||
this.$emit('transitionend');
|
}
|
||||||
|
this.transitionEnded = true;
|
||||||
|
this.$emit("after-" + this.status);
|
||||||
|
var _a = this.data, show = _a.show, display = _a.display;
|
||||||
|
if (!show && display) {
|
||||||
|
this.setData({ display: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,13 @@ component_1.VantComponent({
|
|||||||
value: true
|
value: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
data: {
|
||||||
|
statusBarHeight: 0
|
||||||
|
},
|
||||||
|
created: function () {
|
||||||
|
var statusBarHeight = wx.getSystemInfoSync().statusBarHeight;
|
||||||
|
this.setData({ statusBarHeight: statusBarHeight });
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onClickLeft: function () {
|
onClickLeft: function () {
|
||||||
this.$emit('click-left');
|
this.$emit('click-left');
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||||
|
|
||||||
<view
|
<view
|
||||||
class="{{ utils.bem('nav-bar', { fixed, safe: safeAreaInsetTop }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}"
|
class="{{ utils.bem('nav-bar', { fixed }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}"
|
||||||
style="z-index: {{ zIndex }};"
|
style="z-index: {{ zIndex }}; padding-top: {{ safeAreaInsetTop ? statusBarHeight : 0 }}px;"
|
||||||
>
|
>
|
||||||
<view class="van-nav-bar__left" bind:tap="onClickLeft">
|
<view class="van-nav-bar__left" bind:tap="onClickLeft">
|
||||||
<block wx:if="{{ leftArrow || leftText }}">
|
<block wx:if="{{ leftArrow || leftText }}">
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--white,#fff)}.van-nav-bar--safe{padding-top:env(safe-area-inset-top)}.van-nav-bar__text{display:inline-block;margin:0 -15px;padding:0 15px;vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-weight:500;font-size:16px}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}
|
@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--white,#fff)}.van-nav-bar__text{display:inline-block;margin:0 -15px;padding:0 15px;vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;color:#1989fa;color:var(--blue,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;font-weight:500;font-size:16px}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px}.van-nav-bar__left{left:15px}.van-nav-bar__right{right:15px}
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-rate{display:inline-block;-webkit-user-select:none;user-select:none}.van-rate__item{position:relative;display:inline-block;padding:0 2px;padding:0 var(--rate-horizontal-padding,2px)}.van-rate__icon{display:block;height:1em}.van-rate__icon--half{position:absolute;top:0;width:.5em;overflow:hidden;left:2px;left:var(--rate-horizontal-padding,2px)}
|
@import '../common/index.wxss';.van-rate{display:-webkit-inline-flex;display:inline-flex;-webkit-user-select:none;user-select:none}.van-rate__item{position:relative;padding:0 2px;padding:0 var(--rate-horizontal-padding,2px)}.van-rate__icon{display:block;height:1em}.van-rate__icon--half{position:absolute;top:0;width:.5em;overflow:hidden;left:2px;left:var(--rate-horizontal-padding,2px)}
|
@ -86,7 +86,7 @@ component_1.VantComponent({
|
|||||||
var width = ((value - min) * 100) / this.getRange() + "%";
|
var width = ((value - min) * 100) / this.getRange() + "%";
|
||||||
this.setData({
|
this.setData({
|
||||||
value: value,
|
value: value,
|
||||||
barStyle: "width: " + width + "; height: " + utils_1.addUnit(barHeight) + ";"
|
barStyle: "\n width: " + width + ";\n height: " + utils_1.addUnit(barHeight) + ";\n " + (drag ? 'transition: none;' : '') + "\n ",
|
||||||
});
|
});
|
||||||
if (drag) {
|
if (drag) {
|
||||||
this.$emit('drag', { value: value });
|
this.$emit('drag', { value: value });
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-slider{position:relative;border-radius:999px;background-color:#e5e5e5;background-color:var(--gray-light,#e5e5e5)}.van-slider__bar{position:relative;border-radius:inherit;background-color:#1989fa;background-color:var(--blue,#1989fa)}.van-slider__button{width:20px;height:20px;border-radius:50%;box-shadow:0 1px 2px rgba(0,0,0,.5);background-color:#fff;background-color:var(--white,#fff)}.van-slider__button-wrapper{position:absolute;top:50%;right:0;-webkit-transform:translate3d(50%,-50%,0);transform:translate3d(50%,-50%,0)}.van-slider__button-wrapper:after{position:absolute;top:-50%;left:-50%;width:200%;height:200%;content:""}.van-slider--disabled{opacity:.3}
|
@import '../common/index.wxss';.van-slider{position:relative;border-radius:999px;background-color:#e5e5e5;background-color:var(--gray-light,#e5e5e5)}.van-slider:before{position:absolute;top:-8px;right:0;bottom:-8px;left:0;content:""}.van-slider__bar{position:relative;border-radius:inherit;transition:width .2s;background-color:#1989fa;background-color:var(--blue,#1989fa)}.van-slider__button{width:24px;height:24px;border-radius:50%;box-shadow:0 1px 2px rgba(0,0,0,.5);background-color:#fff;background-color:var(--white,#fff)}.van-slider__button-wrapper{position:absolute;top:50%;right:0;-webkit-transform:translate3d(50%,-50%,0);transform:translate3d(50%,-50%,0)}.van-slider--disabled{opacity:.3}
|
@ -4,6 +4,11 @@ var component_1 = require("../common/component");
|
|||||||
var utils_1 = require("../common/utils");
|
var utils_1 = require("../common/utils");
|
||||||
var LONG_PRESS_START_TIME = 600;
|
var LONG_PRESS_START_TIME = 600;
|
||||||
var LONG_PRESS_INTERVAL = 200;
|
var LONG_PRESS_INTERVAL = 200;
|
||||||
|
// add num and avoid float number
|
||||||
|
function add(num1, num2) {
|
||||||
|
var cardinal = Math.pow(10, 10);
|
||||||
|
return Math.round((num1 + num2) * cardinal) / cardinal;
|
||||||
|
}
|
||||||
component_1.VantComponent({
|
component_1.VantComponent({
|
||||||
field: true,
|
field: true,
|
||||||
classes: ['input-class', 'plus-class', 'minus-class'],
|
classes: ['input-class', 'plus-class', 'minus-class'],
|
||||||
@ -15,7 +20,10 @@ component_1.VantComponent({
|
|||||||
buttonSize: null,
|
buttonSize: null,
|
||||||
asyncChange: Boolean,
|
asyncChange: Boolean,
|
||||||
disableInput: Boolean,
|
disableInput: Boolean,
|
||||||
decimalLength: Number,
|
decimalLength: {
|
||||||
|
type: Number,
|
||||||
|
value: null
|
||||||
|
},
|
||||||
min: {
|
min: {
|
||||||
type: null,
|
type: null,
|
||||||
value: 1
|
value: 1
|
||||||
@ -107,10 +115,7 @@ component_1.VantComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var diff = type === 'minus' ? -this.data.step : +this.data.step;
|
var diff = type === 'minus' ? -this.data.step : +this.data.step;
|
||||||
var value = +this.data.value + diff;
|
var value = add(+this.data.value, diff);
|
||||||
if (!utils_1.isDef(this.data.decimalLength)) {
|
|
||||||
value = Math.round(value * 100) / 100;
|
|
||||||
}
|
|
||||||
this.triggerInput(this.range(value));
|
this.triggerInput(this.range(value));
|
||||||
this.$emit(type);
|
this.$emit(type);
|
||||||
},
|
},
|
||||||
|
@ -80,7 +80,7 @@ component_1.VantComponent({
|
|||||||
trackStyle: '',
|
trackStyle: '',
|
||||||
wrapStyle: '',
|
wrapStyle: '',
|
||||||
position: '',
|
position: '',
|
||||||
currentIndex: null,
|
currentIndex: 0,
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
swipeThreshold: function () {
|
swipeThreshold: function () {
|
||||||
@ -187,7 +187,7 @@ component_1.VantComponent({
|
|||||||
setActiveTab: function () {
|
setActiveTab: function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
if (!utils_1.isDef(this.currentName)) {
|
if (!utils_1.isDef(this.currentName)) {
|
||||||
this.currentName = this.data.active || this.children[0].computedName;
|
this.currentName = this.data.active || (this.children[0] || {}).computedName;
|
||||||
}
|
}
|
||||||
this.children.forEach(function (item, index) {
|
this.children.forEach(function (item, index) {
|
||||||
var data = {
|
var data = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user