mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-24 23:49:15 +08:00
build: compile 1.5.2
This commit is contained in:
parent
11445bed02
commit
e8b3c3fc8d
2
dist/cell/index.wxss
vendored
2
dist/cell/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-cell{position:relative;display:-webkit-flex;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:5px}.van-cell__right-icon-wrap{margin-left:5px;color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)}
|
@import '../common/index.wxss';.van-cell{position:relative;display:-webkit-flex;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:5px}.van-cell__right-icon-wrap{margin-left:5px;color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)}
|
2
dist/common/index.wxss
vendored
2
dist/common/index.wxss
vendored
@ -1 +1 @@
|
|||||||
.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{display:table;clear:both;content:""}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
|
.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{display:table;clear:both;content:""}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
|
2
dist/common/style/hairline.wxss
vendored
2
dist/common/style/hairline.wxss
vendored
@ -1 +1 @@
|
|||||||
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
|
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
|
2
dist/common/utils.d.ts
vendored
2
dist/common/utils.d.ts
vendored
@ -1,7 +1,6 @@
|
|||||||
/// <reference types="wechat-miniprogram" />
|
/// <reference types="wechat-miniprogram" />
|
||||||
export declare function isDef(value: any): boolean;
|
export declare function isDef(value: any): boolean;
|
||||||
export declare function isObj(x: any): boolean;
|
export declare function isObj(x: any): boolean;
|
||||||
export declare function isNumber(value: any): boolean;
|
|
||||||
export declare function range(num: number, min: number, max: number): number;
|
export declare function range(num: number, min: number, max: number): number;
|
||||||
export declare function nextTick(fn: Function): void;
|
export declare function nextTick(fn: Function): void;
|
||||||
export declare function getSystemInfoSync(): WechatMiniprogram.GetSystemInfoSyncResult;
|
export declare function getSystemInfoSync(): WechatMiniprogram.GetSystemInfoSyncResult;
|
||||||
@ -9,6 +8,7 @@ export declare function addUnit(value?: string | number): string | undefined;
|
|||||||
export declare function requestAnimationFrame(
|
export declare function requestAnimationFrame(
|
||||||
cb: Function
|
cb: Function
|
||||||
): void | WechatMiniprogram.NodesRef;
|
): void | WechatMiniprogram.NodesRef;
|
||||||
|
export declare function pickExclude(obj: unknown, keys: string[]): {};
|
||||||
export declare function getRect(
|
export declare function getRect(
|
||||||
this: WechatMiniprogram.Component.TrivialInstance,
|
this: WechatMiniprogram.Component.TrivialInstance,
|
||||||
selector: string
|
selector: string
|
||||||
|
15
dist/common/utils.js
vendored
15
dist/common/utils.js
vendored
@ -1,3 +1,4 @@
|
|||||||
|
import { isNumber, isPlainObject } from './validator';
|
||||||
export function isDef(value) {
|
export function isDef(value) {
|
||||||
return value !== undefined && value !== null;
|
return value !== undefined && value !== null;
|
||||||
}
|
}
|
||||||
@ -5,9 +6,6 @@ export function isObj(x) {
|
|||||||
const type = typeof x;
|
const type = typeof x;
|
||||||
return x !== null && (type === 'object' || type === 'function');
|
return x !== null && (type === 'object' || type === 'function');
|
||||||
}
|
}
|
||||||
export function isNumber(value) {
|
|
||||||
return /^\d+(\.\d+)?$/.test(value);
|
|
||||||
}
|
|
||||||
export function range(num, min, max) {
|
export function range(num, min, max) {
|
||||||
return Math.min(Math.max(num, min), max);
|
return Math.min(Math.max(num, min), max);
|
||||||
}
|
}
|
||||||
@ -43,6 +41,17 @@ export function requestAnimationFrame(cb) {
|
|||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
export function pickExclude(obj, keys) {
|
||||||
|
if (!isPlainObject(obj)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return Object.keys(obj).reduce((prev, key) => {
|
||||||
|
if (!keys.includes(key)) {
|
||||||
|
prev[key] = obj[key];
|
||||||
|
}
|
||||||
|
return prev;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
export function getRect(selector) {
|
export function getRect(selector) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
wx.createSelectorQuery()
|
wx.createSelectorQuery()
|
||||||
|
11
dist/common/validator.d.ts
vendored
Normal file
11
dist/common/validator.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export declare function isFunction(val: unknown): val is Function;
|
||||||
|
export declare function isPlainObject(
|
||||||
|
val: unknown
|
||||||
|
): val is Record<string, unknown>;
|
||||||
|
export declare function isPromise<T = unknown>(val: unknown): val is Promise<T>;
|
||||||
|
export declare function isDef(value: any): boolean;
|
||||||
|
export declare function isObj(x: unknown): x is Record<string, unknown>;
|
||||||
|
export declare function isNumber(value: string): boolean;
|
||||||
|
export declare function isBoolean(value: unknown): value is boolean;
|
||||||
|
export declare function isImageUrl(url: string): boolean;
|
||||||
|
export declare function isVideoUrl(url: string): boolean;
|
30
dist/common/validator.js
vendored
Normal file
30
dist/common/validator.js
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
export function isFunction(val) {
|
||||||
|
return typeof val === 'function';
|
||||||
|
}
|
||||||
|
export function isPlainObject(val) {
|
||||||
|
return val !== null && typeof val === 'object' && !Array.isArray(val);
|
||||||
|
}
|
||||||
|
export function isPromise(val) {
|
||||||
|
return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||||
|
}
|
||||||
|
export function isDef(value) {
|
||||||
|
return value !== undefined && value !== null;
|
||||||
|
}
|
||||||
|
export function isObj(x) {
|
||||||
|
const type = typeof x;
|
||||||
|
return x !== null && (type === 'object' || type === 'function');
|
||||||
|
}
|
||||||
|
export function isNumber(value) {
|
||||||
|
return /^\d+(\.\d+)?$/.test(value);
|
||||||
|
}
|
||||||
|
export function isBoolean(value) {
|
||||||
|
return typeof value === 'boolean';
|
||||||
|
}
|
||||||
|
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
||||||
|
const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i;
|
||||||
|
export function isImageUrl(url) {
|
||||||
|
return IMAGE_REGEXP.test(url);
|
||||||
|
}
|
||||||
|
export function isVideoUrl(url) {
|
||||||
|
return VIDEO_REGEXP.test(url);
|
||||||
|
}
|
1
dist/definitions/index.js
vendored
1
dist/definitions/index.js
vendored
@ -0,0 +1 @@
|
|||||||
|
export {};
|
1
dist/definitions/weapp.js
vendored
1
dist/definitions/weapp.js
vendored
@ -0,0 +1 @@
|
|||||||
|
export {};
|
23
dist/goods-action-icon/index.wxml
vendored
23
dist/goods-action-icon/index.wxml
vendored
@ -22,17 +22,14 @@
|
|||||||
bindgetphonenumber="bindGetPhoneNumber"
|
bindgetphonenumber="bindGetPhoneNumber"
|
||||||
bindlaunchapp="bindLaunchApp"
|
bindlaunchapp="bindLaunchApp"
|
||||||
>
|
>
|
||||||
<view class="van-goods-action-icon__content">
|
<van-icon
|
||||||
<van-icon
|
wx:if="{{ icon }}"
|
||||||
wx:if="{{ icon }}"
|
name="{{ icon }}"
|
||||||
size="20px"
|
dot="{{ dot }}"
|
||||||
name="{{ icon }}"
|
info="{{ info }}"
|
||||||
dot="{{ dot }}"
|
class="van-goods-action-icon__icon"
|
||||||
info="{{ info }}"
|
custom-class="icon-class"
|
||||||
class="van-goods-action-icon__icon"
|
/>
|
||||||
custom-class="icon-class"
|
<slot wx:else name="icon" />
|
||||||
/>
|
<text class="text-class">{{ text }}</text>
|
||||||
<slot name="icon" />
|
|
||||||
<text class="text-class">{{ text }}</text>
|
|
||||||
</view>
|
|
||||||
</van-button>
|
</van-button>
|
||||||
|
2
dist/goods-action-icon/index.wxss
vendored
2
dist/goods-action-icon/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-goods-action-icon{border:none!important;width:50px!important;width:var(--goods-action-icon-height,50px)!important}.van-goods-action-icon__content{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center;height:100%;line-height:1;font-size:10px;font-size:var(--goods-action-icon-font-size,10px);color:#646566;color:var(--goods-action-icon-text-color,#646566)}.van-goods-action-icon__icon{margin-bottom:4px}
|
@import '../common/index.wxss';.van-goods-action-icon{display:-webkit-flex!important;display:flex!important;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center!important;justify-content:center!important;line-height:1!important;border:none!important;font-size:10px!important;font-size:var(--goods-action-icon-font-size,10px)!important;color:#646566!important;color:var(--goods-action-icon-text-color,#646566)!important;min-width:48px;min-width:var(--goods-action-icon-width,48px);height:50px!important;height:var(--goods-action-icon-height,50px)!important}.van-goods-action-icon__icon{display:-webkit-flex;display:flex;margin:0 auto 5px;color:#323233;color:var(--goods-action-icon-color,#323233);font-size:18px;font-size:var(--goods-action-icon-size,18px)}
|
2
dist/goods-action/index.wxss
vendored
2
dist/goods-action/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;background-color:#fff;background-color:var(--goods-action-background-color,#fff)}.van-goods-action--safe{padding-bottom:env(safe-area-inset-bottom)}
|
@import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:50px;height:var(--goods-action-height,50px);background-color:#fff;background-color:var(--goods-action-background-color,#fff)}.van-goods-action--safe{padding-bottom:env(safe-area-inset-bottom)}
|
2
dist/icon/index.wxss
vendored
2
dist/icon/index.wxss
vendored
File diff suppressed because one or more lines are too long
2
dist/share-sheet/options.wxss
vendored
2
dist/share-sheet/options.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-share-sheet__options{position:relative;display:-webkit-flex;display:flex;padding:16px 0 16px 8px;overflow-x:auto;overflow-y:visible;-webkit-overflow-scrolling:touch}.van-share-sheet__options--border:before{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;top:0;right:0;left:16px;border-top:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-share-sheet__options::-webkit-scrollbar{height:0}.van-share-sheet__option{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-user-select:none;user-select:none}.van-share-sheet__option:active{opacity:.7}.van-share-sheet__button{height:auto;padding:0;line-height:inherit;background-color:initial;border:0}.van-share-sheet__button:after{border:0}.van-share-sheet__icon{width:48px;height:48px;margin:0 16px}.van-share-sheet__name{margin-top:8px;padding:0 4px;color:#646566;font-size:12px}.van-share-sheet__option-description{padding:0 4px;color:#c8c9cc;font-size:12px}
|
@import '../common/index.wxss';.van-share-sheet__options{position:relative;display:-webkit-flex;display:flex;padding:16px 0 16px 8px;overflow-x:auto;overflow-y:visible;-webkit-overflow-scrolling:touch}.van-share-sheet__options--border:before{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:0;right:0;left:16px;border-top:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-share-sheet__options::-webkit-scrollbar{height:0}.van-share-sheet__option{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-user-select:none;user-select:none}.van-share-sheet__option:active{opacity:.7}.van-share-sheet__button{height:auto;padding:0;line-height:inherit;background-color:initial;border:0}.van-share-sheet__button:after{border:0}.van-share-sheet__icon{width:48px;height:48px;margin:0 16px}.van-share-sheet__name{margin-top:8px;padding:0 4px;color:#646566;font-size:12px}.van-share-sheet__option-description{padding:0 4px;color:#c8c9cc;font-size:12px}
|
12
dist/tabs/index.wxs
vendored
12
dist/tabs/index.wxs
vendored
@ -68,10 +68,14 @@ function trackStyle(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'transform: translate3d(' + -100 * data.currentIndex + '%, 0, 0)',
|
['left', -100 * data.currentIndex + '%'],
|
||||||
'-webkit-transition-duration: ' + data.duration + 's',
|
['-webkit-transition-duration', data.duration + 's'],
|
||||||
'transition-duration: ' + data.duration + 's',
|
['transition-duration: ', data.duration + 's'],
|
||||||
].join(';');
|
]
|
||||||
|
.map(function (item) {
|
||||||
|
return item.join(':');
|
||||||
|
})
|
||||||
|
.join(';');
|
||||||
}
|
}
|
||||||
|
|
||||||
function lineStyle(data) {
|
function lineStyle(data) {
|
||||||
|
2
dist/tabs/index.wxss
vendored
2
dist/tabs/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{display:-webkit-flex;display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{-webkit-flex:1 0 auto!important;flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-right:8px;padding-left:8px}.van-tabs__scroll{background-color:#fff;background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{margin:0 16px;margin:0 var(--padding-md,16px)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:30px;height:var(--tabs-card-height,30px);border:1px solid #ee0a24;border:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24);border-radius:2px;border-radius:var(--border-radius-sm,2px)}.van-tabs__nav--card .van-tab{color:#ee0a24;color:var(--tabs-default-color,#ee0a24);line-height:28px;line-height:calc(var(--tabs-card-height, 30px) - 2*var(--border-width-base, 1px));border-right:1px solid #ee0a24;border-right:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;color:var(--white,#fff);background-color:#ee0a24;background-color:var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;height:var(--tabs-bottom-bar-height,3px);border-radius:3px;border-radius:var(--tabs-bottom-bar-height,3px);background-color:#ee0a24;background-color:var(--tabs-bottom-bar-color,#ee0a24)}.van-tabs__track{position:relative;width:100%;height:100%}.van-tabs__track--animated{display:-webkit-flex;display:flex;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:44px;height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:30px;height:var(--tabs-card-height,30px)}.van-tab{position:relative;-webkit-flex:1;flex:1;box-sizing:border-box;min-width:0;padding:0 5px;text-align:center;cursor:pointer;color:#646566;color:var(--tab-text-color,#646566);font-size:14px;font-size:var(--tab-font-size,14px);line-height:44px;line-height:var(--tabs-line-height,44px)}.van-tab--active{font-weight:500;font-weight:var(--font-weight-bold,500);color:#323233;color:var(--tab-active-text-color,#323233)}.van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}
|
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{display:-webkit-flex;display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{-webkit-flex:1 0 auto!important;flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-right:8px;padding-left:8px}.van-tabs__scroll{background-color:#fff;background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{margin:0 16px;margin:0 var(--padding-md,16px)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:30px;height:var(--tabs-card-height,30px);border:1px solid #ee0a24;border:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24);border-radius:2px;border-radius:var(--border-radius-sm,2px)}.van-tabs__nav--card .van-tab{color:#ee0a24;color:var(--tabs-default-color,#ee0a24);line-height:28px;line-height:calc(var(--tabs-card-height, 30px) - var(--border-width-base, 1px)*2);border-right:1px solid #ee0a24;border-right:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;color:var(--white,#fff);background-color:#ee0a24;background-color:var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;height:var(--tabs-bottom-bar-height,3px);border-radius:3px;border-radius:var(--tabs-bottom-bar-height,3px);background-color:#ee0a24;background-color:var(--tabs-bottom-bar-color,#ee0a24)}.van-tabs__track{position:relative;width:100%;height:100%}.van-tabs__track--animated{display:-webkit-flex;display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:44px;height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:30px;height:var(--tabs-card-height,30px)}.van-tab{position:relative;-webkit-flex:1;flex:1;box-sizing:border-box;min-width:0;padding:0 5px;text-align:center;cursor:pointer;color:#646566;color:var(--tab-text-color,#646566);font-size:14px;font-size:var(--tab-font-size,14px);line-height:44px;line-height:var(--tabs-line-height,44px)}.van-tab--active{font-weight:500;font-weight:var(--font-weight-bold,500);color:#323233;color:var(--tab-active-text-color,#323233)}.van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}
|
55
dist/uploader/index.js
vendored
55
dist/uploader/index.js
vendored
@ -1,6 +1,7 @@
|
|||||||
import { VantComponent } from '../common/component';
|
import { VantComponent } from '../common/component';
|
||||||
import { isImageFile, isVideo, chooseFile, isPromise } from './utils';
|
import { isImageFile, chooseFile, isVideoFile } from './utils';
|
||||||
import { chooseImageProps, chooseVideoProps } from './shared';
|
import { chooseImageProps, chooseVideoProps } from './shared';
|
||||||
|
import { isBoolean, isPromise } from '../common/validator';
|
||||||
VantComponent({
|
VantComponent({
|
||||||
props: Object.assign(
|
props: Object.assign(
|
||||||
Object.assign(
|
Object.assign(
|
||||||
@ -74,14 +75,12 @@ VantComponent({
|
|||||||
const { fileList = [], maxCount } = this.data;
|
const { fileList = [], maxCount } = this.data;
|
||||||
const lists = fileList.map((item) =>
|
const lists = fileList.map((item) =>
|
||||||
Object.assign(Object.assign({}, item), {
|
Object.assign(Object.assign({}, item), {
|
||||||
isImage:
|
isImage: isImageFile(item),
|
||||||
typeof item.isImage === 'undefined'
|
isVideo: isVideoFile(item),
|
||||||
? isImageFile(item)
|
deletable: isBoolean(item.deletable) ? item.deletable : true,
|
||||||
: item.isImage,
|
|
||||||
deletable:
|
|
||||||
typeof item.deletable === 'undefined' ? true : item.deletable,
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
console.log(lists);
|
||||||
this.setData({ lists, isInCount: lists.length < maxCount });
|
this.setData({ lists, isInCount: lists.length < maxCount });
|
||||||
},
|
},
|
||||||
getDetail(index) {
|
getDetail(index) {
|
||||||
@ -99,13 +98,8 @@ VantComponent({
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let file = null;
|
console.log(res);
|
||||||
if (isVideo(res, accept)) {
|
this.onBeforeRead(multiple ? res : res[0]);
|
||||||
file = Object.assign({ path: res.tempFilePath }, res);
|
|
||||||
} else {
|
|
||||||
file = multiple ? res.tempFiles : res.tempFiles[0];
|
|
||||||
}
|
|
||||||
this.onBeforeRead(file);
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.$emit('error', error);
|
this.$emit('error', error);
|
||||||
@ -139,7 +133,7 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onAfterRead(file) {
|
onAfterRead(file) {
|
||||||
const { maxSize } = this.data;
|
const { maxSize, afterRead } = this.data;
|
||||||
const oversize = Array.isArray(file)
|
const oversize = Array.isArray(file)
|
||||||
? file.some((item) => item.size > maxSize)
|
? file.some((item) => item.size > maxSize)
|
||||||
: file.size > maxSize;
|
: file.size > maxSize;
|
||||||
@ -147,8 +141,8 @@ VantComponent({
|
|||||||
this.$emit('oversize', Object.assign({ file }, this.getDetail()));
|
this.$emit('oversize', Object.assign({ file }, this.getDetail()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof this.data.afterRead === 'function') {
|
if (typeof afterRead === 'function') {
|
||||||
this.data.afterRead(file, this.getDetail());
|
afterRead(file, this.getDetail());
|
||||||
}
|
}
|
||||||
this.$emit('after-read', Object.assign({ file }, this.getDetail()));
|
this.$emit('after-read', Object.assign({ file }, this.getDetail()));
|
||||||
},
|
},
|
||||||
@ -167,32 +161,25 @@ VantComponent({
|
|||||||
const { lists } = this.data;
|
const { lists } = this.data;
|
||||||
const item = lists[index];
|
const item = lists[index];
|
||||||
wx.previewImage({
|
wx.previewImage({
|
||||||
urls: lists
|
urls: lists.filter((item) => isImageFile(item)).map((item) => item.url),
|
||||||
.filter((item) => item.isImage)
|
current: item.url,
|
||||||
.map((item) => item.url || item.path),
|
|
||||||
current: item.url || item.path,
|
|
||||||
fail() {
|
fail() {
|
||||||
wx.showToast({ title: '预览图片失败', icon: 'none' });
|
wx.showToast({ title: '预览图片失败', icon: 'none' });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// fix: accept 为 video 时不能展示视频
|
onPreviewVideo(event) {
|
||||||
onPreviewVideo: function (event) {
|
|
||||||
if (!this.data.previewFullImage) return;
|
if (!this.data.previewFullImage) return;
|
||||||
var index = event.currentTarget.dataset.index;
|
const { index } = event.currentTarget.dataset;
|
||||||
var lists = this.data.lists;
|
const { lists } = this.data;
|
||||||
wx.previewMedia({
|
wx.previewMedia({
|
||||||
sources: lists
|
sources: lists
|
||||||
.filter(function (item) {
|
.filter((item) => isVideoFile(item))
|
||||||
return item.isVideo;
|
.map((item) =>
|
||||||
})
|
Object.assign(Object.assign({}, item), { type: 'video' })
|
||||||
.map(function (item) {
|
),
|
||||||
item.type = 'video';
|
|
||||||
item.url = item.url || item.path;
|
|
||||||
return item;
|
|
||||||
}),
|
|
||||||
current: index,
|
current: index,
|
||||||
fail: function () {
|
fail() {
|
||||||
wx.showToast({ title: '预览视频失败', icon: 'none' });
|
wx.showToast({ title: '预览视频失败', icon: 'none' });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
12
dist/uploader/index.wxml
vendored
12
dist/uploader/index.wxml
vendored
@ -14,7 +14,7 @@
|
|||||||
<image
|
<image
|
||||||
wx:if="{{ item.isImage }}"
|
wx:if="{{ item.isImage }}"
|
||||||
mode="{{ imageFit }}"
|
mode="{{ imageFit }}"
|
||||||
src="{{ item.url || item.path }}"
|
src="{{ item.thumb || item.url }}"
|
||||||
alt="{{ item.name || ('图片' + index) }}"
|
alt="{{ item.name || ('图片' + index) }}"
|
||||||
class="van-uploader__preview-image"
|
class="van-uploader__preview-image"
|
||||||
style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
|
style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
|
||||||
@ -23,8 +23,10 @@
|
|||||||
/>
|
/>
|
||||||
<video
|
<video
|
||||||
wx:elif="{{ item.isVideo }}"
|
wx:elif="{{ item.isVideo }}"
|
||||||
src="{{item.url || item.path}}"
|
src="{{ item.url }}"
|
||||||
autoplay="{{item.autoplay}}"
|
title="{{ item.name || ('视频' + index) }}"
|
||||||
|
poster="{{ item.thumb }}"
|
||||||
|
autoplay="{{ item.autoplay }}"
|
||||||
class="van-uploader__preview-image"
|
class="van-uploader__preview-image"
|
||||||
style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
|
style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
|
||||||
data-index="{{ index }}"
|
data-index="{{ index }}"
|
||||||
@ -37,7 +39,7 @@
|
|||||||
style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
|
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 }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
wx:if="{{ item.status === 'uploading' || item.status === 'failed' }}"
|
wx:if="{{ item.status === 'uploading' || item.status === 'failed' }}"
|
||||||
@ -59,7 +61,7 @@
|
|||||||
|
|
||||||
<!-- 上传样式 -->
|
<!-- 上传样式 -->
|
||||||
<block wx:if="{{ isInCount }}">
|
<block wx:if="{{ isInCount }}">
|
||||||
<view class="van-uploader__slot" bind:tap="startUpload">
|
<view class="van-uploader__slot" bindtap="startUpload">
|
||||||
<slot />
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
27
dist/uploader/utils.d.ts
vendored
27
dist/uploader/utils.d.ts
vendored
@ -1,18 +1,15 @@
|
|||||||
/// <reference types="wechat-miniprogram" />
|
|
||||||
interface File {
|
interface File {
|
||||||
path: string;
|
|
||||||
url: string;
|
url: string;
|
||||||
size: number;
|
size?: number;
|
||||||
name: string;
|
name?: string;
|
||||||
type: string;
|
type: string;
|
||||||
time: number;
|
duration?: number;
|
||||||
image: boolean;
|
time?: number;
|
||||||
|
isImage?: boolean;
|
||||||
|
isVideo?: boolean;
|
||||||
}
|
}
|
||||||
export declare function isImageFile(item: File): boolean;
|
export declare function isImageFile(item: File): boolean;
|
||||||
export declare function isVideo(
|
export declare function isVideoFile(item: File): boolean;
|
||||||
res: any,
|
|
||||||
accept: string
|
|
||||||
): res is WechatMiniprogram.ChooseVideoSuccessCallbackResult;
|
|
||||||
export declare function chooseFile({
|
export declare function chooseFile({
|
||||||
accept,
|
accept,
|
||||||
multiple,
|
multiple,
|
||||||
@ -31,13 +28,5 @@ export declare function chooseFile({
|
|||||||
sizeType: any;
|
sizeType: any;
|
||||||
camera: any;
|
camera: any;
|
||||||
maxCount: any;
|
maxCount: any;
|
||||||
}): Promise<
|
}): Promise<unknown>;
|
||||||
| WechatMiniprogram.ChooseImageSuccessCallbackResult
|
|
||||||
| WechatMiniprogram.ChooseMediaSuccessCallbackResult
|
|
||||||
| WechatMiniprogram.ChooseVideoSuccessCallbackResult
|
|
||||||
| WechatMiniprogram.ChooseMessageFileSuccessCallbackResult
|
|
||||||
>;
|
|
||||||
export declare function isFunction(val: unknown): val is Function;
|
|
||||||
export declare function isObject(val: any): val is Record<any, any>;
|
|
||||||
export declare function isPromise<T = any>(val: unknown): val is Promise<T>;
|
|
||||||
export {};
|
export {};
|
||||||
|
115
dist/uploader/utils.js
vendored
115
dist/uploader/utils.js
vendored
@ -1,21 +1,71 @@
|
|||||||
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
import { pickExclude } from '../common/utils';
|
||||||
function isImageUrl(url) {
|
import { isImageUrl, isVideoUrl } from '../common/validator';
|
||||||
return IMAGE_REGEXP.test(url);
|
|
||||||
}
|
|
||||||
export function isImageFile(item) {
|
export function isImageFile(item) {
|
||||||
if (item.type) {
|
if (item.isImage != null) {
|
||||||
return item.type.indexOf('image') === 0;
|
return item.isImage;
|
||||||
}
|
}
|
||||||
if (item.path) {
|
if (item.type) {
|
||||||
return isImageUrl(item.path);
|
return item.type === 'image';
|
||||||
}
|
}
|
||||||
if (item.url) {
|
if (item.url) {
|
||||||
return isImageUrl(item.url);
|
return isImageUrl(item.url);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
export function isVideo(res, accept) {
|
export function isVideoFile(item) {
|
||||||
return accept === 'video';
|
if (item.isVideo != null) {
|
||||||
|
return item.isVideo;
|
||||||
|
}
|
||||||
|
if (item.type) {
|
||||||
|
return item.type === 'video';
|
||||||
|
}
|
||||||
|
if (item.url) {
|
||||||
|
return isVideoUrl(item.url);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function formatImage(res) {
|
||||||
|
return res.tempFiles.map((item) =>
|
||||||
|
Object.assign(Object.assign({}, pickExclude(item, ['path'])), {
|
||||||
|
type: 'image',
|
||||||
|
url: item.path,
|
||||||
|
thumb: item.path,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function formatVideo(res) {
|
||||||
|
return [
|
||||||
|
Object.assign(
|
||||||
|
Object.assign(
|
||||||
|
{},
|
||||||
|
pickExclude(res, ['tempFilePath', 'thumbTempFilePath', 'errMsg'])
|
||||||
|
),
|
||||||
|
{ type: 'video', url: res.tempFilePath, thumb: res.thumbTempFilePath }
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
function formatMedia(res) {
|
||||||
|
return res.tempFiles.map((item) =>
|
||||||
|
Object.assign(
|
||||||
|
Object.assign(
|
||||||
|
{},
|
||||||
|
pickExclude(item, ['fileType', 'thumbTempFilePath', 'tempFilePath'])
|
||||||
|
),
|
||||||
|
{
|
||||||
|
type: res.type,
|
||||||
|
url: item.tempFilePath,
|
||||||
|
thumb:
|
||||||
|
res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function formatFile(res) {
|
||||||
|
return res.tempFiles.map((item) =>
|
||||||
|
Object.assign(Object.assign({}, pickExclude(item, ['path'])), {
|
||||||
|
url: item.path,
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
export function chooseFile({
|
export function chooseFile({
|
||||||
accept,
|
accept,
|
||||||
@ -27,57 +77,46 @@ export function chooseFile({
|
|||||||
camera,
|
camera,
|
||||||
maxCount,
|
maxCount,
|
||||||
}) {
|
}) {
|
||||||
switch (accept) {
|
return new Promise((resolve, reject) => {
|
||||||
case 'image':
|
switch (accept) {
|
||||||
return new Promise((resolve, reject) => {
|
case 'image':
|
||||||
wx.chooseImage({
|
wx.chooseImage({
|
||||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||||
sourceType: capture,
|
sourceType: capture,
|
||||||
sizeType,
|
sizeType,
|
||||||
success: resolve,
|
success: (res) => resolve(formatImage(res)),
|
||||||
fail: reject,
|
fail: reject,
|
||||||
});
|
});
|
||||||
});
|
break;
|
||||||
case 'media':
|
case 'media':
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
wx.chooseMedia({
|
wx.chooseMedia({
|
||||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||||
sourceType: capture,
|
sourceType: capture,
|
||||||
maxDuration,
|
maxDuration,
|
||||||
sizeType,
|
sizeType,
|
||||||
camera,
|
camera,
|
||||||
success: resolve,
|
success: (res) => resolve(formatMedia(res)),
|
||||||
fail: reject,
|
fail: reject,
|
||||||
});
|
});
|
||||||
});
|
break;
|
||||||
case 'video':
|
case 'video':
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
wx.chooseVideo({
|
wx.chooseVideo({
|
||||||
sourceType: capture,
|
sourceType: capture,
|
||||||
compressed,
|
compressed,
|
||||||
maxDuration,
|
maxDuration,
|
||||||
camera,
|
camera,
|
||||||
success: resolve,
|
success: (res) => resolve(formatVideo(res)),
|
||||||
fail: reject,
|
fail: reject,
|
||||||
});
|
});
|
||||||
});
|
break;
|
||||||
default:
|
default:
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
wx.chooseMessageFile({
|
wx.chooseMessageFile({
|
||||||
count: multiple ? maxCount : 1,
|
count: multiple ? maxCount : 1,
|
||||||
type: 'file',
|
type: accept,
|
||||||
success: resolve,
|
success: (res) => resolve(formatFile(res)),
|
||||||
fail: reject,
|
fail: reject,
|
||||||
});
|
});
|
||||||
});
|
break;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
export function isFunction(val) {
|
|
||||||
return typeof val === 'function';
|
|
||||||
}
|
|
||||||
export function isObject(val) {
|
|
||||||
return val !== null && typeof val === 'object';
|
|
||||||
}
|
|
||||||
export function isPromise(val) {
|
|
||||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-cell{position:relative;display:-webkit-flex;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:5px}.van-cell__right-icon-wrap{margin-left:5px;color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)}
|
@import '../common/index.wxss';.van-cell{position:relative;display:-webkit-flex;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:5px}.van-cell__right-icon-wrap{margin-left:5px;color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)}
|
@ -1 +1 @@
|
|||||||
.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{display:table;clear:both;content:""}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
|
.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{display:table;clear:both;content:""}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
|
@ -1 +1 @@
|
|||||||
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
|
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
exports.getAllRect = exports.getRect = exports.requestAnimationFrame = exports.addUnit = exports.getSystemInfoSync = exports.nextTick = exports.range = exports.isNumber = exports.isObj = exports.isDef = void 0;
|
exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.getSystemInfoSync = exports.nextTick = exports.range = exports.isObj = exports.isDef = void 0;
|
||||||
|
var validator_1 = require('./validator');
|
||||||
function isDef(value) {
|
function isDef(value) {
|
||||||
return value !== undefined && value !== null;
|
return value !== undefined && value !== null;
|
||||||
}
|
}
|
||||||
@ -10,10 +11,6 @@ function isObj(x) {
|
|||||||
return x !== null && (type === 'object' || type === 'function');
|
return x !== null && (type === 'object' || type === 'function');
|
||||||
}
|
}
|
||||||
exports.isObj = isObj;
|
exports.isObj = isObj;
|
||||||
function isNumber(value) {
|
|
||||||
return /^\d+(\.\d+)?$/.test(value);
|
|
||||||
}
|
|
||||||
exports.isNumber = isNumber;
|
|
||||||
function range(num, min, max) {
|
function range(num, min, max) {
|
||||||
return Math.min(Math.max(num, min), max);
|
return Math.min(Math.max(num, min), max);
|
||||||
}
|
}
|
||||||
@ -37,7 +34,7 @@ function addUnit(value) {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
value = String(value);
|
value = String(value);
|
||||||
return isNumber(value) ? value + 'px' : value;
|
return validator_1.isNumber(value) ? value + 'px' : value;
|
||||||
}
|
}
|
||||||
exports.addUnit = addUnit;
|
exports.addUnit = addUnit;
|
||||||
function requestAnimationFrame(cb) {
|
function requestAnimationFrame(cb) {
|
||||||
@ -54,6 +51,18 @@ function requestAnimationFrame(cb) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.requestAnimationFrame = requestAnimationFrame;
|
exports.requestAnimationFrame = requestAnimationFrame;
|
||||||
|
function pickExclude(obj, keys) {
|
||||||
|
if (!validator_1.isPlainObject(obj)) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return Object.keys(obj).reduce(function (prev, key) {
|
||||||
|
if (!keys.includes(key)) {
|
||||||
|
prev[key] = obj[key];
|
||||||
|
}
|
||||||
|
return prev;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
exports.pickExclude = pickExclude;
|
||||||
function getRect(selector) {
|
function getRect(selector) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
|
42
lib/common/validator.js
Normal file
42
lib/common/validator.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
'use strict';
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
exports.isVideoUrl = exports.isImageUrl = exports.isBoolean = exports.isNumber = exports.isObj = exports.isDef = exports.isPromise = exports.isPlainObject = exports.isFunction = void 0;
|
||||||
|
function isFunction(val) {
|
||||||
|
return typeof val === 'function';
|
||||||
|
}
|
||||||
|
exports.isFunction = isFunction;
|
||||||
|
function isPlainObject(val) {
|
||||||
|
return val !== null && typeof val === 'object' && !Array.isArray(val);
|
||||||
|
}
|
||||||
|
exports.isPlainObject = isPlainObject;
|
||||||
|
function isPromise(val) {
|
||||||
|
return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch);
|
||||||
|
}
|
||||||
|
exports.isPromise = isPromise;
|
||||||
|
function isDef(value) {
|
||||||
|
return value !== undefined && value !== null;
|
||||||
|
}
|
||||||
|
exports.isDef = isDef;
|
||||||
|
function isObj(x) {
|
||||||
|
var type = typeof x;
|
||||||
|
return x !== null && (type === 'object' || type === 'function');
|
||||||
|
}
|
||||||
|
exports.isObj = isObj;
|
||||||
|
function isNumber(value) {
|
||||||
|
return /^\d+(\.\d+)?$/.test(value);
|
||||||
|
}
|
||||||
|
exports.isNumber = isNumber;
|
||||||
|
function isBoolean(value) {
|
||||||
|
return typeof value === 'boolean';
|
||||||
|
}
|
||||||
|
exports.isBoolean = isBoolean;
|
||||||
|
var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
||||||
|
var VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i;
|
||||||
|
function isImageUrl(url) {
|
||||||
|
return IMAGE_REGEXP.test(url);
|
||||||
|
}
|
||||||
|
exports.isImageUrl = isImageUrl;
|
||||||
|
function isVideoUrl(url) {
|
||||||
|
return VIDEO_REGEXP.test(url);
|
||||||
|
}
|
||||||
|
exports.isVideoUrl = isVideoUrl;
|
@ -22,17 +22,14 @@
|
|||||||
bindgetphonenumber="bindGetPhoneNumber"
|
bindgetphonenumber="bindGetPhoneNumber"
|
||||||
bindlaunchapp="bindLaunchApp"
|
bindlaunchapp="bindLaunchApp"
|
||||||
>
|
>
|
||||||
<view class="van-goods-action-icon__content">
|
<van-icon
|
||||||
<van-icon
|
wx:if="{{ icon }}"
|
||||||
wx:if="{{ icon }}"
|
name="{{ icon }}"
|
||||||
size="20px"
|
dot="{{ dot }}"
|
||||||
name="{{ icon }}"
|
info="{{ info }}"
|
||||||
dot="{{ dot }}"
|
class="van-goods-action-icon__icon"
|
||||||
info="{{ info }}"
|
custom-class="icon-class"
|
||||||
class="van-goods-action-icon__icon"
|
/>
|
||||||
custom-class="icon-class"
|
<slot wx:else name="icon" />
|
||||||
/>
|
<text class="text-class">{{ text }}</text>
|
||||||
<slot name="icon" />
|
|
||||||
<text class="text-class">{{ text }}</text>
|
|
||||||
</view>
|
|
||||||
</van-button>
|
</van-button>
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-goods-action-icon{border:none!important;width:50px!important;width:var(--goods-action-icon-height,50px)!important}.van-goods-action-icon__content{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center;justify-content:center;height:100%;line-height:1;font-size:10px;font-size:var(--goods-action-icon-font-size,10px);color:#646566;color:var(--goods-action-icon-text-color,#646566)}.van-goods-action-icon__icon{margin-bottom:4px}
|
@import '../common/index.wxss';.van-goods-action-icon{display:-webkit-flex!important;display:flex!important;-webkit-flex-direction:column;flex-direction:column;-webkit-justify-content:center!important;justify-content:center!important;line-height:1!important;border:none!important;font-size:10px!important;font-size:var(--goods-action-icon-font-size,10px)!important;color:#646566!important;color:var(--goods-action-icon-text-color,#646566)!important;min-width:48px;min-width:var(--goods-action-icon-width,48px);height:50px!important;height:var(--goods-action-icon-height,50px)!important}.van-goods-action-icon__icon{display:-webkit-flex;display:flex;margin:0 auto 5px;color:#323233;color:var(--goods-action-icon-color,#323233);font-size:18px;font-size:var(--goods-action-icon-size,18px)}
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;background-color:#fff;background-color:var(--goods-action-background-color,#fff)}.van-goods-action--safe{padding-bottom:env(safe-area-inset-bottom)}
|
@import '../common/index.wxss';.van-goods-action{position:fixed;right:0;bottom:0;left:0;display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:50px;height:var(--goods-action-height,50px);background-color:#fff;background-color:var(--goods-action-background-color,#fff)}.van-goods-action--safe{padding-bottom:env(safe-area-inset-bottom)}
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-share-sheet__options{position:relative;display:-webkit-flex;display:flex;padding:16px 0 16px 8px;overflow-x:auto;overflow-y:visible;-webkit-overflow-scrolling:touch}.van-share-sheet__options--border:before{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;top:0;right:0;left:16px;border-top:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-share-sheet__options::-webkit-scrollbar{height:0}.van-share-sheet__option{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-user-select:none;user-select:none}.van-share-sheet__option:active{opacity:.7}.van-share-sheet__button{height:auto;padding:0;line-height:inherit;background-color:initial;border:0}.van-share-sheet__button:after{border:0}.van-share-sheet__icon{width:48px;height:48px;margin:0 16px}.van-share-sheet__name{margin-top:8px;padding:0 4px;color:#646566;font-size:12px}.van-share-sheet__option-description{padding:0 4px;color:#c8c9cc;font-size:12px}
|
@import '../common/index.wxss';.van-share-sheet__options{position:relative;display:-webkit-flex;display:flex;padding:16px 0 16px 8px;overflow-x:auto;overflow-y:visible;-webkit-overflow-scrolling:touch}.van-share-sheet__options--border:before{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:0;right:0;left:16px;border-top:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-share-sheet__options::-webkit-scrollbar{height:0}.van-share-sheet__option{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-user-select:none;user-select:none}.van-share-sheet__option:active{opacity:.7}.van-share-sheet__button{height:auto;padding:0;line-height:inherit;background-color:initial;border:0}.van-share-sheet__button:after{border:0}.van-share-sheet__icon{width:48px;height:48px;margin:0 16px}.van-share-sheet__name{margin-top:8px;padding:0 4px;color:#646566;font-size:12px}.van-share-sheet__option-description{padding:0 4px;color:#c8c9cc;font-size:12px}
|
@ -68,10 +68,14 @@ function trackStyle(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'transform: translate3d(' + -100 * data.currentIndex + '%, 0, 0)',
|
['left', -100 * data.currentIndex + '%'],
|
||||||
'-webkit-transition-duration: ' + data.duration + 's',
|
['-webkit-transition-duration', data.duration + 's'],
|
||||||
'transition-duration: ' + data.duration + 's',
|
['transition-duration: ', data.duration + 's'],
|
||||||
].join(';');
|
]
|
||||||
|
.map(function (item) {
|
||||||
|
return item.join(':');
|
||||||
|
})
|
||||||
|
.join(';');
|
||||||
}
|
}
|
||||||
|
|
||||||
function lineStyle(data) {
|
function lineStyle(data) {
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{display:-webkit-flex;display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{-webkit-flex:1 0 auto!important;flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-right:8px;padding-left:8px}.van-tabs__scroll{background-color:#fff;background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{margin:0 16px;margin:0 var(--padding-md,16px)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:30px;height:var(--tabs-card-height,30px);border:1px solid #ee0a24;border:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24);border-radius:2px;border-radius:var(--border-radius-sm,2px)}.van-tabs__nav--card .van-tab{color:#ee0a24;color:var(--tabs-default-color,#ee0a24);line-height:28px;line-height:calc(var(--tabs-card-height, 30px) - 2*var(--border-width-base, 1px));border-right:1px solid #ee0a24;border-right:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;color:var(--white,#fff);background-color:#ee0a24;background-color:var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;height:var(--tabs-bottom-bar-height,3px);border-radius:3px;border-radius:var(--tabs-bottom-bar-height,3px);background-color:#ee0a24;background-color:var(--tabs-bottom-bar-color,#ee0a24)}.van-tabs__track{position:relative;width:100%;height:100%}.van-tabs__track--animated{display:-webkit-flex;display:flex;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:44px;height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:30px;height:var(--tabs-card-height,30px)}.van-tab{position:relative;-webkit-flex:1;flex:1;box-sizing:border-box;min-width:0;padding:0 5px;text-align:center;cursor:pointer;color:#646566;color:var(--tab-text-color,#646566);font-size:14px;font-size:var(--tab-font-size,14px);line-height:44px;line-height:var(--tabs-line-height,44px)}.van-tab--active{font-weight:500;font-weight:var(--font-weight-bold,500);color:#323233;color:var(--tab-active-text-color,#323233)}.van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}
|
@import '../common/index.wxss';.van-tabs{position:relative;-webkit-tap-highlight-color:transparent}.van-tabs__wrap{display:-webkit-flex;display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{-webkit-flex:0 0 22%;flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{-webkit-flex:1 0 auto!important;flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-right:8px;padding-left:8px}.van-tabs__scroll{background-color:#fff;background-color:var(--tabs-nav-background-color,#fff)}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{margin:0 16px;margin:0 var(--padding-md,16px)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{position:relative;display:-webkit-flex;display:flex;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:30px;height:var(--tabs-card-height,30px);border:1px solid #ee0a24;border:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24);border-radius:2px;border-radius:var(--border-radius-sm,2px)}.van-tabs__nav--card .van-tab{color:#ee0a24;color:var(--tabs-default-color,#ee0a24);line-height:28px;line-height:calc(var(--tabs-card-height, 30px) - var(--border-width-base, 1px)*2);border-right:1px solid #ee0a24;border-right:var(--border-width-base,1px) solid var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{color:#fff;color:var(--white,#fff);background-color:#ee0a24;background-color:var(--tabs-default-color,#ee0a24)}.van-tabs__nav--card .van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{position:absolute;bottom:0;left:0;z-index:1;height:3px;height:var(--tabs-bottom-bar-height,3px);border-radius:3px;border-radius:var(--tabs-bottom-bar-height,3px);background-color:#ee0a24;background-color:var(--tabs-bottom-bar-color,#ee0a24)}.van-tabs__track{position:relative;width:100%;height:100%}.van-tabs__track--animated{display:-webkit-flex;display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:44px;height:var(--tabs-line-height,44px)}.van-tabs--card .van-tabs__wrap{height:30px;height:var(--tabs-card-height,30px)}.van-tab{position:relative;-webkit-flex:1;flex:1;box-sizing:border-box;min-width:0;padding:0 5px;text-align:center;cursor:pointer;color:#646566;color:var(--tab-text-color,#646566);font-size:14px;font-size:var(--tab-font-size,14px);line-height:44px;line-height:var(--tabs-line-height,44px)}.van-tab--active{font-weight:500;font-weight:var(--font-weight-bold,500);color:#323233;color:var(--tab-active-text-color,#323233)}.van-tab--disabled{color:#c8c9cc;color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;display:inline-block;-webkit-transform:translateX(0)!important;transform:translateX(0)!important}
|
@ -18,6 +18,7 @@ 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 shared_1 = require('./shared');
|
var shared_1 = require('./shared');
|
||||||
|
var validator_1 = require('../common/validator');
|
||||||
component_1.VantComponent({
|
component_1.VantComponent({
|
||||||
props: __assign(
|
props: __assign(
|
||||||
__assign(
|
__assign(
|
||||||
@ -94,14 +95,14 @@ component_1.VantComponent({
|
|||||||
maxCount = _a.maxCount;
|
maxCount = _a.maxCount;
|
||||||
var lists = fileList.map(function (item) {
|
var lists = fileList.map(function (item) {
|
||||||
return __assign(__assign({}, item), {
|
return __assign(__assign({}, item), {
|
||||||
isImage:
|
isImage: utils_1.isImageFile(item),
|
||||||
typeof item.isImage === 'undefined'
|
isVideo: utils_1.isVideoFile(item),
|
||||||
? utils_1.isImageFile(item)
|
deletable: validator_1.isBoolean(item.deletable)
|
||||||
: item.isImage,
|
? item.deletable
|
||||||
deletable:
|
: true,
|
||||||
typeof item.deletable === 'undefined' ? true : item.deletable,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
console.log(lists);
|
||||||
this.setData({ lists: lists, isInCount: lists.length < maxCount });
|
this.setData({ lists: lists, isInCount: lists.length < maxCount });
|
||||||
},
|
},
|
||||||
getDetail: function (index) {
|
getDetail: function (index) {
|
||||||
@ -126,13 +127,8 @@ component_1.VantComponent({
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
.then(function (res) {
|
.then(function (res) {
|
||||||
var file = null;
|
console.log(res);
|
||||||
if (utils_1.isVideo(res, accept)) {
|
_this.onBeforeRead(multiple ? res : res[0]);
|
||||||
file = __assign({ path: res.tempFilePath }, res);
|
|
||||||
} else {
|
|
||||||
file = multiple ? res.tempFiles : res.tempFiles[0];
|
|
||||||
}
|
|
||||||
_this.onBeforeRead(file);
|
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
_this.$emit('error', error);
|
_this.$emit('error', error);
|
||||||
@ -162,7 +158,7 @@ component_1.VantComponent({
|
|||||||
if (!res) {
|
if (!res) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (utils_1.isPromise(res)) {
|
if (validator_1.isPromise(res)) {
|
||||||
res.then(function (data) {
|
res.then(function (data) {
|
||||||
return _this.onAfterRead(data || file);
|
return _this.onAfterRead(data || file);
|
||||||
});
|
});
|
||||||
@ -171,7 +167,9 @@ component_1.VantComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onAfterRead: function (file) {
|
onAfterRead: function (file) {
|
||||||
var maxSize = this.data.maxSize;
|
var _a = this.data,
|
||||||
|
maxSize = _a.maxSize,
|
||||||
|
afterRead = _a.afterRead;
|
||||||
var oversize = Array.isArray(file)
|
var oversize = Array.isArray(file)
|
||||||
? file.some(function (item) {
|
? file.some(function (item) {
|
||||||
return item.size > maxSize;
|
return item.size > maxSize;
|
||||||
@ -181,8 +179,8 @@ component_1.VantComponent({
|
|||||||
this.$emit('oversize', __assign({ file: file }, this.getDetail()));
|
this.$emit('oversize', __assign({ file: file }, this.getDetail()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof this.data.afterRead === 'function') {
|
if (typeof afterRead === 'function') {
|
||||||
this.data.afterRead(file, this.getDetail());
|
afterRead(file, this.getDetail());
|
||||||
}
|
}
|
||||||
this.$emit('after-read', __assign({ file: file }, this.getDetail()));
|
this.$emit('after-read', __assign({ file: file }, this.getDetail()));
|
||||||
},
|
},
|
||||||
@ -203,18 +201,17 @@ component_1.VantComponent({
|
|||||||
wx.previewImage({
|
wx.previewImage({
|
||||||
urls: lists
|
urls: lists
|
||||||
.filter(function (item) {
|
.filter(function (item) {
|
||||||
return item.isImage;
|
return utils_1.isImageFile(item);
|
||||||
})
|
})
|
||||||
.map(function (item) {
|
.map(function (item) {
|
||||||
return item.url || item.path;
|
return item.url;
|
||||||
}),
|
}),
|
||||||
current: item.url || item.path,
|
current: item.url,
|
||||||
fail: function () {
|
fail: function () {
|
||||||
wx.showToast({ title: '预览图片失败', icon: 'none' });
|
wx.showToast({ title: '预览图片失败', icon: 'none' });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// fix: accept 为 video 时不能展示视频
|
|
||||||
onPreviewVideo: function (event) {
|
onPreviewVideo: function (event) {
|
||||||
if (!this.data.previewFullImage) return;
|
if (!this.data.previewFullImage) return;
|
||||||
var index = event.currentTarget.dataset.index;
|
var index = event.currentTarget.dataset.index;
|
||||||
@ -222,12 +219,10 @@ component_1.VantComponent({
|
|||||||
wx.previewMedia({
|
wx.previewMedia({
|
||||||
sources: lists
|
sources: lists
|
||||||
.filter(function (item) {
|
.filter(function (item) {
|
||||||
return item.isVideo;
|
return utils_1.isVideoFile(item);
|
||||||
})
|
})
|
||||||
.map(function (item) {
|
.map(function (item) {
|
||||||
item.type = 'video';
|
return __assign(__assign({}, item), { type: 'video' });
|
||||||
item.url = item.url || item.path;
|
|
||||||
return item;
|
|
||||||
}),
|
}),
|
||||||
current: index,
|
current: index,
|
||||||
fail: function () {
|
fail: function () {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<image
|
<image
|
||||||
wx:if="{{ item.isImage }}"
|
wx:if="{{ item.isImage }}"
|
||||||
mode="{{ imageFit }}"
|
mode="{{ imageFit }}"
|
||||||
src="{{ item.url || item.path }}"
|
src="{{ item.thumb || item.url }}"
|
||||||
alt="{{ item.name || ('图片' + index) }}"
|
alt="{{ item.name || ('图片' + index) }}"
|
||||||
class="van-uploader__preview-image"
|
class="van-uploader__preview-image"
|
||||||
style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
|
style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
|
||||||
@ -23,8 +23,10 @@
|
|||||||
/>
|
/>
|
||||||
<video
|
<video
|
||||||
wx:elif="{{ item.isVideo }}"
|
wx:elif="{{ item.isVideo }}"
|
||||||
src="{{item.url || item.path}}"
|
src="{{ item.url }}"
|
||||||
autoplay="{{item.autoplay}}"
|
title="{{ item.name || ('视频' + index) }}"
|
||||||
|
poster="{{ item.thumb }}"
|
||||||
|
autoplay="{{ item.autoplay }}"
|
||||||
class="van-uploader__preview-image"
|
class="van-uploader__preview-image"
|
||||||
style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
|
style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
|
||||||
data-index="{{ index }}"
|
data-index="{{ index }}"
|
||||||
@ -37,7 +39,7 @@
|
|||||||
style="width: {{ utils.addUnit(previewSize) }}; height: {{ utils.addUnit(previewSize) }};"
|
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 }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
wx:if="{{ item.status === 'uploading' || item.status === 'failed' }}"
|
wx:if="{{ item.status === 'uploading' || item.status === 'failed' }}"
|
||||||
@ -59,7 +61,7 @@
|
|||||||
|
|
||||||
<!-- 上传样式 -->
|
<!-- 上传样式 -->
|
||||||
<block wx:if="{{ isInCount }}">
|
<block wx:if="{{ isInCount }}">
|
||||||
<view class="van-uploader__slot" bind:tap="startUpload">
|
<view class="van-uploader__slot" bindtap="startUpload">
|
||||||
<slot />
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
@ -1,27 +1,100 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
var __assign =
|
||||||
|
(this && this.__assign) ||
|
||||||
|
function () {
|
||||||
|
__assign =
|
||||||
|
Object.assign ||
|
||||||
|
function (t) {
|
||||||
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||||
|
s = arguments[i];
|
||||||
|
for (var p in s)
|
||||||
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
return __assign.apply(this, arguments);
|
||||||
|
};
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
exports.isPromise = exports.isObject = exports.isFunction = exports.chooseFile = exports.isVideo = exports.isImageFile = void 0;
|
exports.chooseFile = exports.isVideoFile = exports.isImageFile = void 0;
|
||||||
var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
|
var utils_1 = require('../common/utils');
|
||||||
function isImageUrl(url) {
|
var validator_1 = require('../common/validator');
|
||||||
return IMAGE_REGEXP.test(url);
|
|
||||||
}
|
|
||||||
function isImageFile(item) {
|
function isImageFile(item) {
|
||||||
if (item.type) {
|
if (item.isImage != null) {
|
||||||
return item.type.indexOf('image') === 0;
|
return item.isImage;
|
||||||
}
|
}
|
||||||
if (item.path) {
|
if (item.type) {
|
||||||
return isImageUrl(item.path);
|
return item.type === 'image';
|
||||||
}
|
}
|
||||||
if (item.url) {
|
if (item.url) {
|
||||||
return isImageUrl(item.url);
|
return validator_1.isImageUrl(item.url);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exports.isImageFile = isImageFile;
|
exports.isImageFile = isImageFile;
|
||||||
function isVideo(res, accept) {
|
function isVideoFile(item) {
|
||||||
return accept === 'video';
|
if (item.isVideo != null) {
|
||||||
|
return item.isVideo;
|
||||||
|
}
|
||||||
|
if (item.type) {
|
||||||
|
return item.type === 'video';
|
||||||
|
}
|
||||||
|
if (item.url) {
|
||||||
|
return validator_1.isVideoUrl(item.url);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
exports.isVideoFile = isVideoFile;
|
||||||
|
function formatImage(res) {
|
||||||
|
return res.tempFiles.map(function (item) {
|
||||||
|
return __assign(__assign({}, utils_1.pickExclude(item, ['path'])), {
|
||||||
|
type: 'image',
|
||||||
|
url: item.path,
|
||||||
|
thumb: item.path,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function formatVideo(res) {
|
||||||
|
return [
|
||||||
|
__assign(
|
||||||
|
__assign(
|
||||||
|
{},
|
||||||
|
utils_1.pickExclude(res, [
|
||||||
|
'tempFilePath',
|
||||||
|
'thumbTempFilePath',
|
||||||
|
'errMsg',
|
||||||
|
])
|
||||||
|
),
|
||||||
|
{ type: 'video', url: res.tempFilePath, thumb: res.thumbTempFilePath }
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
function formatMedia(res) {
|
||||||
|
return res.tempFiles.map(function (item) {
|
||||||
|
return __assign(
|
||||||
|
__assign(
|
||||||
|
{},
|
||||||
|
utils_1.pickExclude(item, [
|
||||||
|
'fileType',
|
||||||
|
'thumbTempFilePath',
|
||||||
|
'tempFilePath',
|
||||||
|
])
|
||||||
|
),
|
||||||
|
{
|
||||||
|
type: res.type,
|
||||||
|
url: item.tempFilePath,
|
||||||
|
thumb:
|
||||||
|
res.type === 'video' ? item.thumbTempFilePath : item.tempFilePath,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function formatFile(res) {
|
||||||
|
return res.tempFiles.map(function (item) {
|
||||||
|
return __assign(__assign({}, utils_1.pickExclude(item, ['path'])), {
|
||||||
|
url: item.path,
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
exports.isVideo = isVideo;
|
|
||||||
function chooseFile(_a) {
|
function chooseFile(_a) {
|
||||||
var accept = _a.accept,
|
var accept = _a.accept,
|
||||||
multiple = _a.multiple,
|
multiple = _a.multiple,
|
||||||
@ -31,61 +104,55 @@ function chooseFile(_a) {
|
|||||||
sizeType = _a.sizeType,
|
sizeType = _a.sizeType,
|
||||||
camera = _a.camera,
|
camera = _a.camera,
|
||||||
maxCount = _a.maxCount;
|
maxCount = _a.maxCount;
|
||||||
switch (accept) {
|
return new Promise(function (resolve, reject) {
|
||||||
case 'image':
|
switch (accept) {
|
||||||
return new Promise(function (resolve, reject) {
|
case 'image':
|
||||||
wx.chooseImage({
|
wx.chooseImage({
|
||||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||||
sourceType: capture,
|
sourceType: capture,
|
||||||
sizeType: sizeType,
|
sizeType: sizeType,
|
||||||
success: resolve,
|
success: function (res) {
|
||||||
|
return resolve(formatImage(res));
|
||||||
|
},
|
||||||
fail: reject,
|
fail: reject,
|
||||||
});
|
});
|
||||||
});
|
break;
|
||||||
case 'media':
|
case 'media':
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
wx.chooseMedia({
|
wx.chooseMedia({
|
||||||
count: multiple ? Math.min(maxCount, 9) : 1,
|
count: multiple ? Math.min(maxCount, 9) : 1,
|
||||||
sourceType: capture,
|
sourceType: capture,
|
||||||
maxDuration: maxDuration,
|
maxDuration: maxDuration,
|
||||||
sizeType: sizeType,
|
sizeType: sizeType,
|
||||||
camera: camera,
|
camera: camera,
|
||||||
success: resolve,
|
success: function (res) {
|
||||||
|
return resolve(formatMedia(res));
|
||||||
|
},
|
||||||
fail: reject,
|
fail: reject,
|
||||||
});
|
});
|
||||||
});
|
break;
|
||||||
case 'video':
|
case 'video':
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
wx.chooseVideo({
|
wx.chooseVideo({
|
||||||
sourceType: capture,
|
sourceType: capture,
|
||||||
compressed: compressed,
|
compressed: compressed,
|
||||||
maxDuration: maxDuration,
|
maxDuration: maxDuration,
|
||||||
camera: camera,
|
camera: camera,
|
||||||
success: resolve,
|
success: function (res) {
|
||||||
|
return resolve(formatVideo(res));
|
||||||
|
},
|
||||||
fail: reject,
|
fail: reject,
|
||||||
});
|
});
|
||||||
});
|
break;
|
||||||
default:
|
default:
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
wx.chooseMessageFile({
|
wx.chooseMessageFile({
|
||||||
count: multiple ? maxCount : 1,
|
count: multiple ? maxCount : 1,
|
||||||
type: 'file',
|
type: accept,
|
||||||
success: resolve,
|
success: function (res) {
|
||||||
|
return resolve(formatFile(res));
|
||||||
|
},
|
||||||
fail: reject,
|
fail: reject,
|
||||||
});
|
});
|
||||||
});
|
break;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
exports.chooseFile = chooseFile;
|
exports.chooseFile = chooseFile;
|
||||||
function isFunction(val) {
|
|
||||||
return typeof val === 'function';
|
|
||||||
}
|
|
||||||
exports.isFunction = isFunction;
|
|
||||||
function isObject(val) {
|
|
||||||
return val !== null && typeof val === 'object';
|
|
||||||
}
|
|
||||||
exports.isObject = isObject;
|
|
||||||
function isPromise(val) {
|
|
||||||
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
||||||
}
|
|
||||||
exports.isPromise = isPromise;
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user