import { defaultTo, round } from 'ut2';
+ import { round } from 'ut2';
import divide from './divide';
import gcd from './gcd';
import loadImageWithBlob from './loadImageWithBlob';
import bytesToSize from './bytesToSize';
-import { revokeObjectURL } from './utils/native';
-import AsyncMemo from './AsyncMemo';
-const asyncMemo = new AsyncMemo({ max: 1, maxStrategy: 'replaced' });
-asyncMemo.cache.on('del', (k, v) => {
- try {
- if (v.r) {
- revokeObjectURL(v.data.image.src);
- }
- }
- catch {
- /* empty */
- }
-});
/**
* 计算宽高比
*
@@ -121,7 +108,6 @@ getImageInfo.js
* @alias module:Other.getImageInfo
* @since 4.20.0
* @param {string | Blob} img 图片地址或 blob 对象
- * @param {boolean | CacheOptions} [cacheOptions=true] 是否使用缓存。开启后,自动缓存最近上一次成功的结果,当图片地址或 blob 对象一致时,直接返回该缓存。避免连续请求同一个图片资源,重复加载。当缓存下一次成功加载的图片时,会自动释放上一次缓存的图片,也可以通过 `autoRevokeOnDel` 设置不释放缓存。
* @param {AjaxOptions} [ajaxOptions] ajax 请求配置项,当传入的图片为字符串时才会触发请求。
* @returns {Promise<ImageInfo>} 图片信息
* @example
@@ -139,34 +125,20 @@ getImageInfo.js
* });
*
*/
-function getImageInfo(img, cacheOptions = true, ajaxOptions) {
- const cacheOptionsIsObject = typeof cacheOptions === 'object';
- const _cacheOptions = {
- useCache: cacheOptionsIsObject ? cacheOptions.useCache !== false : cacheOptions !== false,
- autoRevokeOnDel: cacheOptionsIsObject ? cacheOptions.autoRevokeOnDel !== false : !!cacheOptions,
- cacheKey: defaultTo(cacheOptionsIsObject ? cacheOptions.cacheKey : undefined, typeof img === 'string' ? img : undefined)
- };
- return asyncMemo
- .run(() => {
- return loadImageWithBlob(img, false, ajaxOptions).then(({ image, blob }) => {
- const { width, height } = image;
- const data = {
- width,
- height,
- contrast: calcContrast(width, height),
- measure: `${width} × ${height} px`,
- size: bytesToSize(blob.size),
- bytes: blob.size,
- image,
- blob
- };
- return {
- data,
- r: _cacheOptions.autoRevokeOnDel
- };
- });
- }, _cacheOptions.useCache && _cacheOptions.cacheKey ? _cacheOptions.cacheKey : undefined)
- .then((res) => res.data);
+function getImageInfo(img, ajaxOptions) {
+ return loadImageWithBlob(img, ajaxOptions).then(({ image, blob }) => {
+ const { width, height } = image;
+ return {
+ width,
+ height,
+ contrast: calcContrast(width, height),
+ measure: `${width} × ${height} px`,
+ size: bytesToSize(blob.size),
+ bytes: blob.size,
+ image,
+ blob
+ };
+ });
}
export default getImageInfo;
@@ -183,7 +155,7 @@ getImageInfo.js
diff --git a/global.html b/global.html
index 84f0a751..3fc7c988 100644
--- a/global.html
+++ b/global.html
@@ -977,229 +977,6 @@ Type:
-CacheOptions
-
-
-
-
-
-
-
- - Description:
- 缓存配置
-
-
-
- - Source:
- -
- loadImage.js, line 15
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Properties:
-
-
-
-
-
-
-
- Name
-
-
- Type
-
-
- Attributes
-
-
-
- Default
-
-
- Description
-
-
-
-
-
-
-
-
- useCache
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
- 是否使用缓存
-
-
-
-
-
-
- autoRevokeOnDel
-
-
-
-
-
-boolean
-
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
- 删除时自动释放缓存
-
-
-
-
-
-
- cacheKey
-
-
-
-
-
-string
-
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
-
- 缓存键
-
-
-
-
-
-
-
-
-
-
-
-
- 缓存配置
-
-
-
-
- Type:
-
- -
-
-Object
-
-
-
-
-
-
-
-
-
-
-
-
-
DownloadOptions
@@ -1487,7 +1264,7 @@ ImageInfo
Source:
@@ -1786,7 +1563,7 @@ ImageWithBlob
Source:
@@ -2656,7 +2433,7 @@ Type:
diff --git a/index.html b/index.html
index 91818042..4b2d2197 100644
--- a/index.html
+++ b/index.html
@@ -244,7 +244,7 @@ 精选第三方工具库
diff --git a/index.js.html b/index.js.html
index d1f064a2..0e8c1585 100644
--- a/index.js.html
+++ b/index.js.html
@@ -95,7 +95,6 @@ index.js
export { default as isUrl } from './isUrl';
export { default as isBusinessLicense } from './isBusinessLicense';
export { default as validatePassword } from './validatePassword';
-export { default as isPromiseLike } from './isPromiseLike';
export { default as isHMCard } from './isHMCard';
export { default as isTWCard } from './isTWCard';
export { default as isSwiftCode } from './isSwiftCode';
@@ -112,11 +111,9 @@ index.js
export { default as numberToChinese } from './numberToChinese';
export { default as bytesToSize } from './bytesToSize';
export { default as parseIdCard } from './parseIdCard';
-export { default as blobToDataURL } from './blobToDataURL';
export { default as fileReader } from './fileReader';
export { default as dataURLToBlob } from './dataURLToBlob';
export { default as setDataURLPrefix } from './setDataURLPrefix';
-export { default as normalizeString } from './normalizeString';
export { default as safeDate } from './safeDate';
export { default as formatMobile } from './formatMobile';
export { default as padZero } from './padZero';
@@ -184,7 +181,6 @@ index.js
export { default as loadScript } from './loadScript';
export { default as randomString } from './randomString';
export { default as strlen } from './strlen';
-export { default as waitTime } from './waitTime';
/**
* 树结构数据查询、过滤、转换等处理方法
*
@@ -209,10 +205,6 @@ index.js
// global
import VERSION from './VERSION';
export { VERSION };
-/**
- * @deprecated 即将废弃,请使用 `VERSION`
- */
-export const version = BUILD_VERSION;
// classes
export { default as AsyncMemo } from './AsyncMemo';
@@ -229,7 +221,7 @@ index.js
diff --git a/isBankCard.js.html b/isBankCard.js.html index 7d304265..40829971 100644 --- a/isBankCard.js.html +++ b/isBankCard.js.html @@ -140,7 +140,7 @@
isBankCard.js
diff --git a/isBusinessLicense.js.html b/isBusinessLicense.js.html index ae255df9..b0be7c2e 100644 --- a/isBusinessLicense.js.html +++ b/isBusinessLicense.js.html @@ -125,8 +125,7 @@
isBusinessLicense.js
*/ function isBusinessLicense(value, options = {}) { const valueStr = toString(value); - const { loose = false, checkCode: cc = true } = options; - const needCheckCode = !loose && cc; + const { checkCode: needCheckCode = true } = options; const passBaseRule = baseReg.test(valueStr); // 宽松模式 或 基础规则不通过直接返回 if (!needCheckCode || !passBaseRule) { @@ -155,7 +154,7 @@isBusinessLicense.js
diff --git a/isChinese.js.html b/isChinese.js.html index cbf5c3c8..7fc19579 100644 --- a/isChinese.js.html +++ b/isChinese.js.html @@ -163,7 +163,7 @@
isChinese.js
diff --git a/isEmail.js.html b/isEmail.js.html index 81c22dce..d63e0179 100644 --- a/isEmail.js.html +++ b/isEmail.js.html @@ -107,7 +107,7 @@
isEmail.js
diff --git a/isHMCard.js.html b/isHMCard.js.html index 359d253e..fcda6a2f 100644 --- a/isHMCard.js.html +++ b/isHMCard.js.html @@ -115,7 +115,7 @@
isHMCard.js
diff --git a/isIPv4.js.html b/isIPv4.js.html index 429240be..87d10278 100644 --- a/isIPv4.js.html +++ b/isIPv4.js.html @@ -109,7 +109,7 @@
isIPv4.js
diff --git a/isIPv6.js.html b/isIPv6.js.html index 794f9539..26d3a235 100644 --- a/isIPv6.js.html +++ b/isIPv6.js.html @@ -123,7 +123,7 @@
isIPv6.js
diff --git a/isIdCard.js.html b/isIdCard.js.html index ca2433c8..665b0178 100644 --- a/isIdCard.js.html +++ b/isIdCard.js.html @@ -153,7 +153,7 @@
isIdCard.js
diff --git a/isMobile.js.html b/isMobile.js.html index 12b04955..b443efd3 100644 --- a/isMobile.js.html +++ b/isMobile.js.html @@ -107,7 +107,7 @@
isMobile.js
diff --git a/isPassport.js.html b/isPassport.js.html index 46d29a01..65c292fc 100644 --- a/isPassport.js.html +++ b/isPassport.js.html @@ -109,7 +109,7 @@
isPassport.js
diff --git a/isPassword.js.html b/isPassword.js.html index 48314adb..8e7ce00d 100644 --- a/isPassword.js.html +++ b/isPassword.js.html @@ -124,7 +124,7 @@
isPassword.js
diff --git a/isPostcode.js.html b/isPostcode.js.html index 04abb168..20f2980e 100644 --- a/isPostcode.js.html +++ b/isPostcode.js.html @@ -107,7 +107,7 @@
isPostcode.js
diff --git a/isQQ.js.html b/isQQ.js.html index ecf1986e..18db4437 100644 --- a/isQQ.js.html +++ b/isQQ.js.html @@ -107,7 +107,7 @@
isQQ.js
diff --git a/isSocialCreditCode.js.html b/isSocialCreditCode.js.html index fc75c748..c47f39c0 100644 --- a/isSocialCreditCode.js.html +++ b/isSocialCreditCode.js.html @@ -123,10 +123,9 @@
isSocialCreditCode.js
* isSocialCreditCode('91350100M000100Y', { checkCode: false }); // false * */ -function isSocialCreditCode(value, options = {}) { +function isSocialCreditCode(value, options) { const valueStr = toString(value); - const { loose = false, checkCode: cc = true } = options; - const needCheckCode = !loose && cc; + const { checkCode: needCheckCode = true } = options || {}; const passBaseRule = baseReg.test(valueStr); // 宽松模式 或 基础规则不通过直接返回 if (!needCheckCode || !passBaseRule) { @@ -155,7 +154,7 @@isSocialCreditCode.js
diff --git a/isSwiftCode.js.html b/isSwiftCode.js.html index 8dfcf6b1..2d0faec8 100644 --- a/isSwiftCode.js.html +++ b/isSwiftCode.js.html @@ -112,7 +112,7 @@
isSwiftCode.js
diff --git a/isTWCard.js.html b/isTWCard.js.html index 8d730e6c..9e9f1996 100644 --- a/isTWCard.js.html +++ b/isTWCard.js.html @@ -121,7 +121,7 @@
isTWCard.js
diff --git a/isTelephone.js.html b/isTelephone.js.html index f3e9c9a5..eff461a9 100644 --- a/isTelephone.js.html +++ b/isTelephone.js.html @@ -113,7 +113,7 @@
isTelephone.js
diff --git a/isUrl.js.html b/isUrl.js.html index 96e16110..b192b105 100644 --- a/isUrl.js.html +++ b/isUrl.js.html @@ -137,7 +137,7 @@
isUrl.js
diff --git a/isValidNumber.js.html b/isValidNumber.js.html index 10496375..0162f490 100644 --- a/isValidNumber.js.html +++ b/isValidNumber.js.html @@ -139,7 +139,7 @@
isValidNumber.js
diff --git a/isVehicle.js.html b/isVehicle.js.html index 7474fc6b..96df588c 100644 --- a/isVehicle.js.html +++ b/isVehicle.js.html @@ -115,7 +115,7 @@
isVehicle.js
diff --git a/isWX.js.html b/isWX.js.html index 372060af..ab156501 100644 --- a/isWX.js.html +++ b/isWX.js.html @@ -107,7 +107,7 @@
isWX.js
diff --git a/lcm.js.html b/lcm.js.html index 1c63a85f..43292554 100644 --- a/lcm.js.html +++ b/lcm.js.html @@ -127,7 +127,7 @@
lcm.js
diff --git a/listToTree.js.html b/listToTree.js.html index 0572bdfd..5c2d65e7 100644 --- a/listToTree.js.html +++ b/listToTree.js.html @@ -186,7 +186,7 @@
listToTree.js
diff --git a/loadImage.js.html b/loadImage.js.html index 28631c02..710584d2 100644 --- a/loadImage.js.html +++ b/loadImage.js.html @@ -71,26 +71,8 @@
loadImage.js
import { defaultTo, isBlob } from 'ut2';
+ import { isBlob } from 'ut2';
import { createObjectURL, revokeObjectURL } from './utils/native';
-import AsyncMemo from './AsyncMemo';
-const asyncMemo = new AsyncMemo({ max: 1, maxStrategy: 'replaced' });
-asyncMemo.cache.on('del', (k, v) => {
- try {
- if (v.r) {
- revokeObjectURL(v.data.src);
- }
- }
- catch {
- /* empty */
- }
-});
-/**
- * @typedef {Object} CacheOptions 缓存配置
- * @property {boolean} [useCache=true] 是否使用缓存
- * @property {boolean} [autoRevokeOnDel=true] 删除时自动释放缓存
- * @property {string} [cacheKey] 缓存键
- */
/**
* 加载图片。
*
@@ -100,7 +82,6 @@ loadImage.js
* @alias module:Other.loadImage
* @since 4.20.0
* @param {string | Blob} img 图片地址或 blob 对象
- * @param {boolean | CacheOptions} [cacheOptions=true] 是否使用缓存。开启后,自动缓存最近上一次成功的结果,当图片地址或 blob 对象一致时,直接返回该缓存。避免连续请求同一个图片资源,重复加载。当缓存下一次成功加载的图片时,会自动释放上一次缓存的图片,也可以通过 `autoRevokeOnDel` 设置不释放缓存。
* @returns {Promise<HTMLImageElement>} HTML图片元素
* @example
*
@@ -117,39 +98,26 @@ loadImage.js
* });
*
*/
-function loadImage(img, cacheOptions = true) {
- const cacheOptionsIsObject = typeof cacheOptions === 'object';
- const _cacheOptions = {
- useCache: cacheOptionsIsObject ? cacheOptions.useCache !== false : cacheOptions !== false,
- autoRevokeOnDel: cacheOptionsIsObject ? cacheOptions.autoRevokeOnDel !== false : !!cacheOptions,
- cacheKey: defaultTo(cacheOptionsIsObject ? cacheOptions.cacheKey : undefined, typeof img === 'string' ? img : undefined)
- };
- return asyncMemo
- .run(() => {
- return new Promise((resolve, reject) => {
- const imgIsBlob = isBlob(img);
- const url = imgIsBlob ? createObjectURL(img) : img;
- const image = new Image();
- if (!imgIsBlob) {
- image.crossOrigin = 'anonymous';
+function loadImage(img) {
+ return new Promise((resolve, reject) => {
+ const imgIsBlob = isBlob(img);
+ const url = imgIsBlob ? createObjectURL(img) : img;
+ const image = new Image();
+ if (!imgIsBlob) {
+ image.crossOrigin = 'anonymous';
+ }
+ image.onload = () => {
+ resolve(image);
+ };
+ image.onerror = (err) => {
+ if (imgIsBlob) {
+ revokeObjectURL(url);
}
- image.onload = () => {
- resolve({
- data: image,
- r: _cacheOptions.autoRevokeOnDel
- });
- };
- image.onerror = (err) => {
- if (imgIsBlob) {
- revokeObjectURL(url);
- }
- console.error(`[loadImage] The image load failed, '${img}'.`);
- reject(err);
- };
- image.src = url;
- });
- }, _cacheOptions.useCache && _cacheOptions.cacheKey ? _cacheOptions.cacheKey : undefined)
- .then((res) => res.data);
+ console.error(`[loadImage] The image load failed, '${img}'.`);
+ reject(err);
+ };
+ image.src = url;
+ });
}
export default loadImage;
@@ -166,7 +134,7 @@ loadImage.js
diff --git a/loadImageWithBlob.js.html b/loadImageWithBlob.js.html
index 08b7b212..9e5e30c5 100644
--- a/loadImageWithBlob.js.html
+++ b/loadImageWithBlob.js.html
@@ -73,19 +73,6 @@ loadImageWithBlob.js
import { createObjectURL, revokeObjectURL } from './utils/native';
import getFileBlob from './getFileBlob';
-import AsyncMemo from './AsyncMemo';
-import { defaultTo } from 'ut2';
-const asyncMemo = new AsyncMemo({ max: 1, maxStrategy: 'replaced' });
-asyncMemo.cache.on('del', (k, v) => {
- try {
- if (v.r) {
- revokeObjectURL(v.data.image.src);
- }
- }
- catch {
- /* empty */
- }
-});
/**
* @typedef {Object} ImageWithBlob HTML图片元素和 blob 对象
* @property {HTMLImageElement} image HTML图片元素
@@ -94,13 +81,14 @@ loadImageWithBlob.js
/**
* 加载图片,返回图片元素和 blob 对象。
*
+ * 如果传入图片地址,将通过 ajax 请求转为 blob 格式。
+ *
* <em style="font-weight: bold;">注意:该方法仅适用于浏览器端。</em>
*
* @method
* @alias module:Other.loadImageWithBlob
* @since 4.20.0
* @param {string | Blob} img 图片地址或 blob 对象
- * @param {boolean | CacheOptions} [cacheOptions=true] 是否使用缓存。开启后,自动缓存最近上一次成功的结果,当图片地址或 blob 对象一致时,直接返回该缓存。避免连续请求同一个图片资源,重复加载。当缓存下一次成功加载的图片时,会自动释放上一次缓存的图片,也可以通过 `autoRevokeOnDel` 设置不释放缓存。
* @param {AjaxOptions} [ajaxOptions] ajax 请求配置项,当传入的图片为字符串时才会触发请求。
* @returns {Promise<ImageWithBlob>} HTML图片元素和 blob 对象
* @example
@@ -118,38 +106,24 @@ loadImageWithBlob.js
* });
*
*/
-function loadImageWithBlob(img, cacheOptions = true, ajaxOptions) {
- const cacheOptionsIsObject = typeof cacheOptions === 'object';
- const _cacheOptions = {
- useCache: cacheOptionsIsObject ? cacheOptions.useCache !== false : cacheOptions !== false,
- autoRevokeOnDel: cacheOptionsIsObject ? cacheOptions.autoRevokeOnDel !== false : !!cacheOptions,
- cacheKey: defaultTo(cacheOptionsIsObject ? cacheOptions.cacheKey : undefined, typeof img === 'string' ? img : undefined)
- };
- return asyncMemo
- .run(() => {
- return new Promise((resolve, reject) => {
- getFileBlob(img, ajaxOptions)
- .then((blob) => {
- const url = createObjectURL(blob);
- const image = new Image();
- image.onload = () => {
- const data = { blob, image };
- resolve({
- data,
- r: _cacheOptions.autoRevokeOnDel
- });
- };
- image.onerror = (err) => {
- revokeObjectURL(url);
- console.error(`[loadImageWithBlob] The image load failed, '${img}'.`);
- reject(err);
- };
- image.src = url;
- })
- .catch(reject);
- });
- }, _cacheOptions.useCache && _cacheOptions.cacheKey ? _cacheOptions.cacheKey : undefined)
- .then((res) => res.data);
+function loadImageWithBlob(img, ajaxOptions) {
+ return new Promise((resolve, reject) => {
+ getFileBlob(img, ajaxOptions)
+ .then((blob) => {
+ const url = createObjectURL(blob);
+ const image = new Image();
+ image.onload = () => {
+ resolve({ blob, image });
+ };
+ image.onerror = (err) => {
+ revokeObjectURL(url);
+ console.error(`[loadImageWithBlob] The image load failed, '${img}'.`);
+ reject(err);
+ };
+ image.src = url;
+ })
+ .catch(reject);
+ });
}
export default loadImageWithBlob;
@@ -166,7 +140,7 @@ loadImageWithBlob.js
diff --git a/loadScript.js.html b/loadScript.js.html
index 47713fb0..f8cbc3e4 100644
--- a/loadScript.js.html
+++ b/loadScript.js.html
@@ -152,7 +152,7 @@ loadScript.js
diff --git a/minus.js.html b/minus.js.html
index c800b49d..6e4d4f69 100644
--- a/minus.js.html
+++ b/minus.js.html
@@ -125,7 +125,7 @@ minus.js
diff --git a/module-Math.html b/module-Math.html
index a1440017..409648ad 100644
--- a/module-Math.html
+++ b/module-Math.html
@@ -102,7 +102,7 @@ Math
Source:
@@ -1624,7 +1624,7 @@ Returns:
diff --git a/module-Other.html b/module-Other.html
index 4bdf8e5f..34fd51df 100644
--- a/module-Other.html
+++ b/module-Other.html
@@ -102,7 +102,7 @@ Other
Source:
@@ -902,7 +902,7 @@ Source:
@@ -1622,49 +1622,6 @@ Properties
-
-
- cacheImage
-
-
-
-
-
-boolean
-|
-
-CacheOptions
-
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
- 是否使用 loadImageWithBlob
缓存。
-
-
-
-
ajaxOptions
@@ -1698,7 +1655,7 @@ Properties
- ajax 请求配置项,当传入的图片为字符串时才会触发请求。
+ ajax 请求配置项,当传入图片地址时才会触发ajax请求。
@@ -2225,7 +2182,7 @@ Returns:
- (static) getImageInfo(img, cacheOptionsopt, ajaxOptionsopt) → {Promise.<ImageInfo>}
+ (static) getImageInfo(img, ajaxOptionsopt) → {Promise.<ImageInfo>}
@@ -2242,7 +2199,7 @@ Source:
@@ -2324,8 +2281,6 @@ Parameters:
- Default
-
Description
@@ -2363,59 +2318,12 @@ Parameters:
-
-
-
-
图片地址或 blob 对象
-
-
- cacheOptions
-
-
-
-
-
-boolean
-|
-
-CacheOptions
-
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
- 是否使用缓存。开启后,自动缓存最近上一次成功的结果,当图片地址或 blob 对象一致时,直接返回该缓存。避免连续请求同一个图片资源,重复加载。当缓存下一次成功加载的图片时,会自动释放上一次缓存的图片,也可以通过 autoRevokeOnDel
设置不释放缓存。
-
-
-
-
ajaxOptions
@@ -2444,10 +2352,6 @@ Parameters:
-
-
-
-
ajax 请求配置项,当传入的图片为字符串时才会触发请求。
@@ -2502,7 +2406,7 @@ Returns:
- (static) loadImage(img, cacheOptionsopt) → {Promise.<HTMLImageElement>}
+ (static) loadImage(img) → {Promise.<HTMLImageElement>}
@@ -2519,7 +2423,7 @@ Source:
@@ -2597,12 +2501,8 @@ Parameters:
Type
- Attributes
-
- Default
-
Description
@@ -2630,68 +2530,13 @@ Parameters:
-
-
-
-
-
-
-
-
-
-
-
-
图片地址或 blob 对象
-
-
-
- cacheOptions
-
-
-
-
-
-boolean
-|
-
-CacheOptions
-
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
- 是否使用缓存。开启后,自动缓存最近上一次成功的结果,当图片地址或 blob 对象一致时,直接返回该缓存。避免连续请求同一个图片资源,重复加载。当缓存下一次成功加载的图片时,会自动释放上一次缓存的图片,也可以通过 autoRevokeOnDel
设置不释放缓存。
-
-
-
@@ -2741,7 +2586,7 @@ Returns:
- (static) loadImageWithBlob(img, cacheOptionsopt, ajaxOptionsopt) → {Promise.<ImageWithBlob>}
+ (static) loadImageWithBlob(img, ajaxOptionsopt) → {Promise.<ImageWithBlob>}
@@ -2752,13 +2597,14 @@ Description:
加载图片,返回图片元素和 blob 对象。
+如果传入图片地址,将通过 ajax 请求转为 blob 格式。
注意:该方法仅适用于浏览器端。
Source:
@@ -2840,8 +2686,6 @@ Parameters:
- Default
-
Description
@@ -2879,59 +2723,12 @@ Parameters:
-
-
-
-
图片地址或 blob 对象
-
-
- cacheOptions
-
-
-
-
-
-boolean
-|
-
-CacheOptions
-
-
-
-
-
-
-
-
-
- <optional>
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
-
-
- 是否使用缓存。开启后,自动缓存最近上一次成功的结果,当图片地址或 blob 对象一致时,直接返回该缓存。避免连续请求同一个图片资源,重复加载。当缓存下一次成功加载的图片时,会自动释放上一次缓存的图片,也可以通过 autoRevokeOnDel
设置不释放缓存。
-
-
-
-
ajaxOptions
@@ -2960,10 +2757,6 @@ Parameters:
-
-
-
-
ajax 请求配置项,当传入的图片为字符串时才会触发请求。
@@ -3849,7 +3642,7 @@ Returns:
diff --git a/module-Processor.html b/module-Processor.html
index 57118ac5..33e54464 100644
--- a/module-Processor.html
+++ b/module-Processor.html
@@ -102,7 +102,7 @@ Processor
Source:
@@ -1022,7 +1022,7 @@ Example
// 脱敏银行卡
formatBankCard('6228********890'); // 6228 **** **** 890
-// 16位银行卡,"-"间隔
+// 自定义间隔符
formatBankCard('6228480402564890', {spaceMark: '-'}); // 6228-4804-0256-4890
@@ -4328,7 +4328,7 @@ Returns:
diff --git a/module-Tree.html b/module-Tree.html index 8e7f93c0..08b1a275 100644 --- a/module-Tree.html +++ b/module-Tree.html @@ -102,7 +102,7 @@
Tree
Returns:
diff --git a/module-Validator.html b/module-Validator.html index 4d3e63fb..e77379fc 100644 --- a/module-Validator.html +++ b/module-Validator.html @@ -5422,7 +5422,7 @@
Returns:
diff --git a/numberToChinese.js.html b/numberToChinese.js.html index 71d0ccaa..4f699c24 100644 --- a/numberToChinese.js.html +++ b/numberToChinese.js.html @@ -279,7 +279,7 @@
numberToChinese.js
diff --git a/padZero.js.html b/padZero.js.html index b51b8fde..492e383c 100644 --- a/padZero.js.html +++ b/padZero.js.html @@ -121,7 +121,7 @@
padZero.js
diff --git a/parseIdCard.js.html b/parseIdCard.js.html index 21b28ea3..6888d36d 100644 --- a/parseIdCard.js.html +++ b/parseIdCard.js.html @@ -197,7 +197,7 @@
parseIdCard.js
diff --git a/plus.js.html b/plus.js.html index 085bf631..a333f458 100644 --- a/plus.js.html +++ b/plus.js.html @@ -125,7 +125,7 @@
plus.js
diff --git a/randomString.js.html b/randomString.js.html index b834c6d9..060c7c6b 100644 --- a/randomString.js.html +++ b/randomString.js.html @@ -140,7 +140,7 @@
randomString.js
diff --git a/replaceChar.js.html b/replaceChar.js.html index a5a3bc3e..ca9af39b 100644 --- a/replaceChar.js.html +++ b/replaceChar.js.html @@ -161,7 +161,7 @@
replaceChar.js
diff --git a/round.js.html b/round.js.html index 701e996d..f3504397 100644 --- a/round.js.html +++ b/round.js.html @@ -106,7 +106,7 @@
round.js
diff --git a/safeDate.js.html b/safeDate.js.html index d54f344a..86e83acc 100644 --- a/safeDate.js.html +++ b/safeDate.js.html @@ -117,7 +117,7 @@
safeDate.js
diff --git a/setDataURLPrefix.js.html b/setDataURLPrefix.js.html index 9c98b779..b58bba6d 100644 --- a/setDataURLPrefix.js.html +++ b/setDataURLPrefix.js.html @@ -114,7 +114,7 @@
setDataURLPrefix.js
diff --git a/strlen.js.html b/strlen.js.html index e6175953..dda6946a 100644 --- a/strlen.js.html +++ b/strlen.js.html @@ -119,7 +119,7 @@
strlen.js
diff --git a/times.js.html b/times.js.html index 6b140428..ca4664de 100644 --- a/times.js.html +++ b/times.js.html @@ -128,7 +128,7 @@
times.js
diff --git a/transformFieldNames.js.html b/transformFieldNames.js.html index 5f4f66d2..09eb2317 100644 --- a/transformFieldNames.js.html +++ b/transformFieldNames.js.html @@ -166,7 +166,7 @@
transformFieldNames.js
diff --git a/transformObjectValue.js.html b/transformObjectValue.js.html index 74e40348..88213313 100644 --- a/transformObjectValue.js.html +++ b/transformObjectValue.js.html @@ -163,7 +163,7 @@
transformObjectValue.js
diff --git a/treeToList.js.html b/treeToList.js.html index efb9e5b9..f9630448 100644 --- a/treeToList.js.html +++ b/treeToList.js.html @@ -159,7 +159,7 @@
treeToList.js
diff --git a/validatePassword.js.html b/validatePassword.js.html index bea6472a..fda5477c 100644 --- a/validatePassword.js.html +++ b/validatePassword.js.html @@ -301,7 +301,7 @@