提交初始版本,使用vant ui库
This commit is contained in:
		
							
								
								
									
										7
									
								
								miniprogram_npm/@vant/weapp/common/color.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								miniprogram_npm/@vant/weapp/common/color.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| export declare const RED = "#ee0a24"; | ||||
| export declare const BLUE = "#1989fa"; | ||||
| export declare const WHITE = "#fff"; | ||||
| export declare const GREEN = "#07c160"; | ||||
| export declare const ORANGE = "#ff976a"; | ||||
| export declare const GRAY = "#323233"; | ||||
| export declare const GRAY_DARK = "#969799"; | ||||
							
								
								
									
										10
									
								
								miniprogram_npm/@vant/weapp/common/color.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								miniprogram_npm/@vant/weapp/common/color.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.GRAY_DARK = exports.GRAY = exports.ORANGE = exports.GREEN = exports.WHITE = exports.BLUE = exports.RED = void 0; | ||||
| exports.RED = '#ee0a24'; | ||||
| exports.BLUE = '#1989fa'; | ||||
| exports.WHITE = '#fff'; | ||||
| exports.GREEN = '#07c160'; | ||||
| exports.ORANGE = '#ff976a'; | ||||
| exports.GRAY = '#323233'; | ||||
| exports.GRAY_DARK = '#969799'; | ||||
							
								
								
									
										4
									
								
								miniprogram_npm/@vant/weapp/common/component.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								miniprogram_npm/@vant/weapp/common/component.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| /// <reference types="miniprogram-api-typings" /> | ||||
| import { VantComponentOptions } from 'definitions/index'; | ||||
| declare function VantComponent<Data extends WechatMiniprogram.Component.DataOption, Props extends WechatMiniprogram.Component.PropertyOption, Methods extends WechatMiniprogram.Component.MethodOption>(vantOptions: VantComponentOptions<Data, Props, Methods>): void; | ||||
| export { VantComponent }; | ||||
							
								
								
									
										49
									
								
								miniprogram_npm/@vant/weapp/common/component.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								miniprogram_npm/@vant/weapp/common/component.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.VantComponent = void 0; | ||||
| var basic_1 = require("../mixins/basic"); | ||||
| function mapKeys(source, target, map) { | ||||
|     Object.keys(map).forEach(function (key) { | ||||
|         if (source[key]) { | ||||
|             target[map[key]] = source[key]; | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| function VantComponent(vantOptions) { | ||||
|     var options = {}; | ||||
|     mapKeys(vantOptions, options, { | ||||
|         data: 'data', | ||||
|         props: 'properties', | ||||
|         watch: 'observers', | ||||
|         mixins: 'behaviors', | ||||
|         methods: 'methods', | ||||
|         beforeCreate: 'created', | ||||
|         created: 'attached', | ||||
|         mounted: 'ready', | ||||
|         destroyed: 'detached', | ||||
|         classes: 'externalClasses', | ||||
|     }); | ||||
|     // add default externalClasses | ||||
|     options.externalClasses = options.externalClasses || []; | ||||
|     options.externalClasses.push('custom-class'); | ||||
|     // add default behaviors | ||||
|     options.behaviors = options.behaviors || []; | ||||
|     options.behaviors.push(basic_1.basic); | ||||
|     // add relations | ||||
|     var relation = vantOptions.relation; | ||||
|     if (relation) { | ||||
|         options.relations = relation.relations; | ||||
|         options.behaviors.push(relation.mixin); | ||||
|     } | ||||
|     // map field to form-field behavior | ||||
|     if (vantOptions.field) { | ||||
|         options.behaviors.push('wx://form-field'); | ||||
|     } | ||||
|     // add default options | ||||
|     options.options = { | ||||
|         multipleSlots: true, | ||||
|         addGlobalClass: true, | ||||
|     }; | ||||
|     Component(options); | ||||
| } | ||||
| exports.VantComponent = VantComponent; | ||||
							
								
								
									
										1
									
								
								miniprogram_npm/@vant/weapp/common/index.wxss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								miniprogram_npm/@vant/weapp/common/index.wxss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| .van-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{clear:both;content:"";display:table}.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{border:0 solid #ebedf0;bottom:-50%;box-sizing:border-box;content:" ";left:-50%;pointer-events:none;position:absolute;right:-50%;top:-50%;transform:scale(.5);transform-origin:center}.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} | ||||
							
								
								
									
										15
									
								
								miniprogram_npm/@vant/weapp/common/relation.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								miniprogram_npm/@vant/weapp/common/relation.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| /// <reference types="miniprogram-api-typings" /> | ||||
| type TrivialInstance = WechatMiniprogram.Component.TrivialInstance; | ||||
| export declare function useParent(name: string, onEffect?: (this: TrivialInstance) => void): { | ||||
|     relations: { | ||||
|         [x: string]: WechatMiniprogram.Component.RelationOption; | ||||
|     }; | ||||
|     mixin: string; | ||||
| }; | ||||
| export declare function useChildren(name: string, onEffect?: (this: TrivialInstance, target: TrivialInstance) => void): { | ||||
|     relations: { | ||||
|         [x: string]: WechatMiniprogram.Component.RelationOption; | ||||
|     }; | ||||
|     mixin: string; | ||||
| }; | ||||
| export {}; | ||||
							
								
								
									
										65
									
								
								miniprogram_npm/@vant/weapp/common/relation.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								miniprogram_npm/@vant/weapp/common/relation.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,65 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.useChildren = exports.useParent = void 0; | ||||
| function useParent(name, onEffect) { | ||||
|     var _a; | ||||
|     var path = "../".concat(name, "/index"); | ||||
|     return { | ||||
|         relations: (_a = {}, | ||||
|             _a[path] = { | ||||
|                 type: 'ancestor', | ||||
|                 linked: function () { | ||||
|                     onEffect && onEffect.call(this); | ||||
|                 }, | ||||
|                 linkChanged: function () { | ||||
|                     onEffect && onEffect.call(this); | ||||
|                 }, | ||||
|                 unlinked: function () { | ||||
|                     onEffect && onEffect.call(this); | ||||
|                 }, | ||||
|             }, | ||||
|             _a), | ||||
|         mixin: Behavior({ | ||||
|             created: function () { | ||||
|                 var _this = this; | ||||
|                 Object.defineProperty(this, 'parent', { | ||||
|                     get: function () { return _this.getRelationNodes(path)[0]; }, | ||||
|                 }); | ||||
|                 Object.defineProperty(this, 'index', { | ||||
|                     // @ts-ignore | ||||
|                     get: function () { var _a, _b; return (_b = (_a = _this.parent) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b.indexOf(_this); }, | ||||
|                 }); | ||||
|             }, | ||||
|         }), | ||||
|     }; | ||||
| } | ||||
| exports.useParent = useParent; | ||||
| function useChildren(name, onEffect) { | ||||
|     var _a; | ||||
|     var path = "../".concat(name, "/index"); | ||||
|     return { | ||||
|         relations: (_a = {}, | ||||
|             _a[path] = { | ||||
|                 type: 'descendant', | ||||
|                 linked: function (target) { | ||||
|                     onEffect && onEffect.call(this, target); | ||||
|                 }, | ||||
|                 linkChanged: function (target) { | ||||
|                     onEffect && onEffect.call(this, target); | ||||
|                 }, | ||||
|                 unlinked: function (target) { | ||||
|                     onEffect && onEffect.call(this, target); | ||||
|                 }, | ||||
|             }, | ||||
|             _a), | ||||
|         mixin: Behavior({ | ||||
|             created: function () { | ||||
|                 var _this = this; | ||||
|                 Object.defineProperty(this, 'children', { | ||||
|                     get: function () { return _this.getRelationNodes(path) || []; }, | ||||
|                 }); | ||||
|             }, | ||||
|         }), | ||||
|     }; | ||||
| } | ||||
| exports.useChildren = useChildren; | ||||
							
								
								
									
										1
									
								
								miniprogram_npm/@vant/weapp/common/style/clearfix.wxss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								miniprogram_npm/@vant/weapp/common/style/clearfix.wxss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| .van-clearfix:after{clear:both;content:"";display:table} | ||||
							
								
								
									
										1
									
								
								miniprogram_npm/@vant/weapp/common/style/ellipsis.wxss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								miniprogram_npm/@vant/weapp/common/style/ellipsis.wxss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| .van-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.van-multi-ellipsis--l3{-webkit-line-clamp:3} | ||||
							
								
								
									
										1
									
								
								miniprogram_npm/@vant/weapp/common/style/hairline.wxss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								miniprogram_npm/@vant/weapp/common/style/hairline.wxss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +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{border:0 solid #ebedf0;bottom:-50%;box-sizing:border-box;content:" ";left:-50%;pointer-events:none;position:absolute;right:-50%;top:-50%;transform:scale(.5);transform-origin:center}.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} | ||||
							
								
								
									
										0
									
								
								miniprogram_npm/@vant/weapp/common/style/var.wxss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								miniprogram_npm/@vant/weapp/common/style/var.wxss
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										21
									
								
								miniprogram_npm/@vant/weapp/common/utils.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								miniprogram_npm/@vant/weapp/common/utils.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| /// <reference types="node" /> | ||||
| /// <reference types="miniprogram-api-typings" /> | ||||
| /// <reference types="miniprogram-api-typings" /> | ||||
| /// <reference types="miniprogram-api-typings" /> | ||||
| /// <reference types="miniprogram-api-typings" /> | ||||
| export { isDef } from './validator'; | ||||
| export { getSystemInfoSync } from './version'; | ||||
| export declare function range(num: number, min: number, max: number): number; | ||||
| export declare function nextTick(cb: (...args: any[]) => void): void; | ||||
| export declare function addUnit(value?: string | number): string | undefined; | ||||
| export declare function requestAnimationFrame(cb: () => void): NodeJS.Timeout; | ||||
| export declare function pickExclude(obj: unknown, keys: string[]): {}; | ||||
| export declare function getRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult>; | ||||
| export declare function getAllRect(context: WechatMiniprogram.Component.TrivialInstance, selector: string): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>; | ||||
| export declare function groupSetData(context: WechatMiniprogram.Component.TrivialInstance, cb: () => void): void; | ||||
| export declare function toPromise(promiseLike: Promise<unknown> | unknown): Promise<unknown>; | ||||
| export declare function addNumber(num1: any, num2: any): number; | ||||
| export declare const clamp: (num: any, min: any, max: any) => number; | ||||
| export declare function getCurrentPage<T>(): T & WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> & WechatMiniprogram.Page.InstanceProperties & WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> & WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> & WechatMiniprogram.IAnyObject; | ||||
| export declare const isPC: boolean; | ||||
| export declare const isWxWork: boolean; | ||||
							
								
								
									
										109
									
								
								miniprogram_npm/@vant/weapp/common/utils.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								miniprogram_npm/@vant/weapp/common/utils.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,109 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.isWxWork = exports.isPC = exports.getCurrentPage = exports.clamp = exports.addNumber = exports.toPromise = exports.groupSetData = exports.getAllRect = exports.getRect = exports.pickExclude = exports.requestAnimationFrame = exports.addUnit = exports.nextTick = exports.range = exports.getSystemInfoSync = exports.isDef = void 0; | ||||
| var validator_1 = require("./validator"); | ||||
| var version_1 = require("./version"); | ||||
| var validator_2 = require("./validator"); | ||||
| Object.defineProperty(exports, "isDef", { enumerable: true, get: function () { return validator_2.isDef; } }); | ||||
| var version_2 = require("./version"); | ||||
| Object.defineProperty(exports, "getSystemInfoSync", { enumerable: true, get: function () { return version_2.getSystemInfoSync; } }); | ||||
| function range(num, min, max) { | ||||
|     return Math.min(Math.max(num, min), max); | ||||
| } | ||||
| exports.range = range; | ||||
| function nextTick(cb) { | ||||
|     if ((0, version_1.canIUseNextTick)()) { | ||||
|         wx.nextTick(cb); | ||||
|     } | ||||
|     else { | ||||
|         setTimeout(function () { | ||||
|             cb(); | ||||
|         }, 1000 / 30); | ||||
|     } | ||||
| } | ||||
| exports.nextTick = nextTick; | ||||
| function addUnit(value) { | ||||
|     if (!(0, validator_1.isDef)(value)) { | ||||
|         return undefined; | ||||
|     } | ||||
|     value = String(value); | ||||
|     return (0, validator_1.isNumber)(value) ? "".concat(value, "px") : value; | ||||
| } | ||||
| exports.addUnit = addUnit; | ||||
| function requestAnimationFrame(cb) { | ||||
|     return setTimeout(function () { | ||||
|         cb(); | ||||
|     }, 1000 / 30); | ||||
| } | ||||
| exports.requestAnimationFrame = requestAnimationFrame; | ||||
| function pickExclude(obj, keys) { | ||||
|     if (!(0, 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(context, selector) { | ||||
|     return new Promise(function (resolve) { | ||||
|         wx.createSelectorQuery() | ||||
|             .in(context) | ||||
|             .select(selector) | ||||
|             .boundingClientRect() | ||||
|             .exec(function (rect) { | ||||
|             if (rect === void 0) { rect = []; } | ||||
|             return resolve(rect[0]); | ||||
|         }); | ||||
|     }); | ||||
| } | ||||
| exports.getRect = getRect; | ||||
| function getAllRect(context, selector) { | ||||
|     return new Promise(function (resolve) { | ||||
|         wx.createSelectorQuery() | ||||
|             .in(context) | ||||
|             .selectAll(selector) | ||||
|             .boundingClientRect() | ||||
|             .exec(function (rect) { | ||||
|             if (rect === void 0) { rect = []; } | ||||
|             return resolve(rect[0]); | ||||
|         }); | ||||
|     }); | ||||
| } | ||||
| exports.getAllRect = getAllRect; | ||||
| function groupSetData(context, cb) { | ||||
|     if ((0, version_1.canIUseGroupSetData)()) { | ||||
|         context.groupSetData(cb); | ||||
|     } | ||||
|     else { | ||||
|         cb(); | ||||
|     } | ||||
| } | ||||
| exports.groupSetData = groupSetData; | ||||
| function toPromise(promiseLike) { | ||||
|     if ((0, validator_1.isPromise)(promiseLike)) { | ||||
|         return promiseLike; | ||||
|     } | ||||
|     return Promise.resolve(promiseLike); | ||||
| } | ||||
| exports.toPromise = toPromise; | ||||
| // 浮点数精度处理 | ||||
| function addNumber(num1, num2) { | ||||
|     var cardinal = Math.pow(10, 10); | ||||
|     return Math.round((num1 + num2) * cardinal) / cardinal; | ||||
| } | ||||
| exports.addNumber = addNumber; | ||||
| // 限制value在[min, max]之间 | ||||
| var clamp = function (num, min, max) { return Math.min(Math.max(num, min), max); }; | ||||
| exports.clamp = clamp; | ||||
| function getCurrentPage() { | ||||
|     var pages = getCurrentPages(); | ||||
|     return pages[pages.length - 1]; | ||||
| } | ||||
| exports.getCurrentPage = getCurrentPage; | ||||
| exports.isPC = ['mac', 'windows'].includes((0, version_1.getSystemInfoSync)().platform); | ||||
| // 是否企业微信 | ||||
| exports.isWxWork = (0, version_1.getSystemInfoSync)().environment === 'wxwork'; | ||||
							
								
								
									
										9
									
								
								miniprogram_npm/@vant/weapp/common/validator.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								miniprogram_npm/@vant/weapp/common/validator.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| 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: unknown): 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; | ||||
							
								
								
									
										43
									
								
								miniprogram_npm/@vant/weapp/common/validator.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								miniprogram_npm/@vant/weapp/common/validator.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| "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; | ||||
| // eslint-disable-next-line @typescript-eslint/ban-types | ||||
| 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; | ||||
							
								
								
									
										15
									
								
								miniprogram_npm/@vant/weapp/common/version.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								miniprogram_npm/@vant/weapp/common/version.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| /// <reference types="miniprogram-api-typings" /> | ||||
| interface WxWorkSystemInfo extends WechatMiniprogram.SystemInfo { | ||||
|     environment?: 'wxwork'; | ||||
| } | ||||
| interface SystemInfo extends WxWorkSystemInfo, WechatMiniprogram.SystemInfo { | ||||
| } | ||||
| export declare function getSystemInfoSync(): SystemInfo; | ||||
| export declare function canIUseModel(): boolean; | ||||
| export declare function canIUseFormFieldButton(): boolean; | ||||
| export declare function canIUseAnimate(): boolean; | ||||
| export declare function canIUseGroupSetData(): boolean; | ||||
| export declare function canIUseNextTick(): boolean; | ||||
| export declare function canIUseCanvas2d(): boolean; | ||||
| export declare function canIUseGetUserProfile(): boolean; | ||||
| export {}; | ||||
							
								
								
									
										70
									
								
								miniprogram_npm/@vant/weapp/common/version.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								miniprogram_npm/@vant/weapp/common/version.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.canIUseGetUserProfile = exports.canIUseCanvas2d = exports.canIUseNextTick = exports.canIUseGroupSetData = exports.canIUseAnimate = exports.canIUseFormFieldButton = exports.canIUseModel = exports.getSystemInfoSync = void 0; | ||||
| var systemInfo; | ||||
| function getSystemInfoSync() { | ||||
|     if (systemInfo == null) { | ||||
|         systemInfo = wx.getSystemInfoSync(); | ||||
|     } | ||||
|     return systemInfo; | ||||
| } | ||||
| exports.getSystemInfoSync = getSystemInfoSync; | ||||
| function compareVersion(v1, v2) { | ||||
|     v1 = v1.split('.'); | ||||
|     v2 = v2.split('.'); | ||||
|     var len = Math.max(v1.length, v2.length); | ||||
|     while (v1.length < len) { | ||||
|         v1.push('0'); | ||||
|     } | ||||
|     while (v2.length < len) { | ||||
|         v2.push('0'); | ||||
|     } | ||||
|     for (var i = 0; i < len; i++) { | ||||
|         var num1 = parseInt(v1[i], 10); | ||||
|         var num2 = parseInt(v2[i], 10); | ||||
|         if (num1 > num2) { | ||||
|             return 1; | ||||
|         } | ||||
|         if (num1 < num2) { | ||||
|             return -1; | ||||
|         } | ||||
|     } | ||||
|     return 0; | ||||
| } | ||||
| function gte(version) { | ||||
|     var system = getSystemInfoSync(); | ||||
|     return compareVersion(system.SDKVersion, version) >= 0; | ||||
| } | ||||
| function canIUseModel() { | ||||
|     return gte('2.9.3'); | ||||
| } | ||||
| exports.canIUseModel = canIUseModel; | ||||
| function canIUseFormFieldButton() { | ||||
|     return gte('2.10.3'); | ||||
| } | ||||
| exports.canIUseFormFieldButton = canIUseFormFieldButton; | ||||
| function canIUseAnimate() { | ||||
|     return gte('2.9.0'); | ||||
| } | ||||
| exports.canIUseAnimate = canIUseAnimate; | ||||
| function canIUseGroupSetData() { | ||||
|     return gte('2.4.0'); | ||||
| } | ||||
| exports.canIUseGroupSetData = canIUseGroupSetData; | ||||
| function canIUseNextTick() { | ||||
|     try { | ||||
|         return wx.canIUse('nextTick'); | ||||
|     } | ||||
|     catch (e) { | ||||
|         return gte('2.7.1'); | ||||
|     } | ||||
| } | ||||
| exports.canIUseNextTick = canIUseNextTick; | ||||
| function canIUseCanvas2d() { | ||||
|     return gte('2.9.0'); | ||||
| } | ||||
| exports.canIUseCanvas2d = canIUseCanvas2d; | ||||
| function canIUseGetUserProfile() { | ||||
|     return !!wx.getUserProfile; | ||||
| } | ||||
| exports.canIUseGetUserProfile = canIUseGetUserProfile; | ||||
		Reference in New Issue
	
	Block a user