mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-02-05 00:49:49 +08:00
【升级】升级uView前端UI框架到2.0.36版本。
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2020 www.uviewui.com
|
Copyright (c) 2023 www.uviewui.com
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
## 2.0.36(2023-03-27)
|
||||||
|
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||||
|
|
||||||
|
1. 重构`deepClone` & `deepMerge`方法
|
||||||
|
2. 其他优化
|
||||||
## 2.0.34(2022-09-24)
|
## 2.0.34(2022-09-24)
|
||||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
* @event {Function} confirm 点击确认按钮时触发
|
* @event {Function} confirm 点击确认按钮时触发
|
||||||
* @event {Function} cancel 点击取消按钮时触发
|
* @event {Function} cancel 点击取消按钮时触发
|
||||||
* @event {Function} close 点击遮罩关闭出发,closeOnClickOverlay为true有效
|
* @event {Function} close 点击遮罩关闭出发,closeOnClickOverlay为true有效
|
||||||
* @example <u-loadmore :status="status" icon-type="iconType" load-text="loadText" />
|
* @example <u-modal :show="true" title="title" content="content"></u-modal>
|
||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
name: 'u-modal',
|
name: 'u-modal',
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 文字装饰,下划线,中划线等,可选值 none|underline|line-through
|
// 文字装饰,下划线,中划线等,可选值 none|underline|line-through
|
||||||
decoration: {
|
decoration: {
|
||||||
tepe: String,
|
type: String,
|
||||||
default: uni.$u.props.text.decoration
|
default: uni.$u.props.text.decoration
|
||||||
},
|
},
|
||||||
// 外边距,对象、字符串,数值形式均可
|
// 外边距,对象、字符串,数值形式均可
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// 此版本发布于2022-00-24
|
// 此版本发布于2023-03-27
|
||||||
const version = '2.0.34'
|
const version = '2.0.36'
|
||||||
|
|
||||||
// 开发环境才提示,生产环境不会提示
|
// 开发环境才提示,生产环境不会提示
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import test from './test.js'
|
|||||||
import { round } from './digit.js'
|
import { round } from './digit.js'
|
||||||
/**
|
/**
|
||||||
* @description 如果value小于min,取min;如果value大于max,取max
|
* @description 如果value小于min,取min;如果value大于max,取max
|
||||||
* @param {number} min
|
* @param {number} min
|
||||||
* @param {number} max
|
* @param {number} max
|
||||||
* @param {number} value
|
* @param {number} value
|
||||||
*/
|
*/
|
||||||
function range(min = 0, max = 0, value = 0) {
|
function range(min = 0, max = 0, value = 0) {
|
||||||
@@ -13,7 +13,7 @@ function range(min = 0, max = 0, value = 0) {
|
|||||||
/**
|
/**
|
||||||
* @description 用于获取用户传递值的px值 如果用户传递了"xxpx"或者"xxrpx",取出其数值部分,如果是"xxxrpx"还需要用过uni.upx2px进行转换
|
* @description 用于获取用户传递值的px值 如果用户传递了"xxpx"或者"xxrpx",取出其数值部分,如果是"xxxrpx"还需要用过uni.upx2px进行转换
|
||||||
* @param {number|string} value 用户传递值的px值
|
* @param {number|string} value 用户传递值的px值
|
||||||
* @param {boolean} unit
|
* @param {boolean} unit
|
||||||
* @returns {number|string}
|
* @returns {number|string}
|
||||||
*/
|
*/
|
||||||
function getPx(value, unit = false) {
|
function getPx(value, unit = false) {
|
||||||
@@ -41,7 +41,7 @@ function sleep(value = 30) {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @description 运行期判断平台
|
* @description 运行期判断平台
|
||||||
* @returns {string} 返回所在平台(小写)
|
* @returns {string} 返回所在平台(小写)
|
||||||
* @link 运行期判断平台 https://uniapp.dcloud.io/frame?id=判断平台
|
* @link 运行期判断平台 https://uniapp.dcloud.io/frame?id=判断平台
|
||||||
*/
|
*/
|
||||||
function os() {
|
function os() {
|
||||||
@@ -49,7 +49,7 @@ function os() {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @description 获取系统信息同步接口
|
* @description 获取系统信息同步接口
|
||||||
* @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
|
* @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
|
||||||
*/
|
*/
|
||||||
function sys() {
|
function sys() {
|
||||||
return uni.getSystemInfoSync()
|
return uni.getSystemInfoSync()
|
||||||
@@ -179,22 +179,34 @@ function addUnit(value = 'auto', unit = uni?.$u?.config?.unit ?? 'px') {
|
|||||||
/**
|
/**
|
||||||
* @description 深度克隆
|
* @description 深度克隆
|
||||||
* @param {object} obj 需要深度克隆的对象
|
* @param {object} obj 需要深度克隆的对象
|
||||||
|
* @param cache 缓存
|
||||||
* @returns {*} 克隆后的对象或者原值(不是对象)
|
* @returns {*} 克隆后的对象或者原值(不是对象)
|
||||||
*/
|
*/
|
||||||
function deepClone(obj) {
|
function deepClone(obj, cache = new WeakMap()) {
|
||||||
// 对常见的“非”值,直接返回原来值
|
if (obj === null || typeof obj !== 'object') return obj;
|
||||||
if ([null, undefined, NaN, false].includes(obj)) return obj
|
if (cache.has(obj)) return cache.get(obj);
|
||||||
if (typeof obj !== 'object' && typeof obj !== 'function') {
|
let clone;
|
||||||
// 原始类型直接返回
|
if (obj instanceof Date) {
|
||||||
return obj
|
clone = new Date(obj.getTime());
|
||||||
}
|
} else if (obj instanceof RegExp) {
|
||||||
const o = test.array(obj) ? [] : {}
|
clone = new RegExp(obj);
|
||||||
for (const i in obj) {
|
} else if (obj instanceof Map) {
|
||||||
if (obj.hasOwnProperty(i)) {
|
clone = new Map(Array.from(obj, ([key, value]) => [key, deepClone(value, cache)]));
|
||||||
o[i] = typeof obj[i] === 'object' ? deepClone(obj[i]) : obj[i]
|
} else if (obj instanceof Set) {
|
||||||
|
clone = new Set(Array.from(obj, value => deepClone(value, cache)));
|
||||||
|
} else if (Array.isArray(obj)) {
|
||||||
|
clone = obj.map(value => deepClone(value, cache));
|
||||||
|
} else if (Object.prototype.toString.call(obj) === '[object Object]') {
|
||||||
|
clone = Object.create(Object.getPrototypeOf(obj));
|
||||||
|
cache.set(obj, clone);
|
||||||
|
for (const [key, value] of Object.entries(obj)) {
|
||||||
|
clone[key] = deepClone(value, cache);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
clone = Object.assign({}, obj);
|
||||||
}
|
}
|
||||||
return o
|
cache.set(obj, clone);
|
||||||
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -205,24 +217,27 @@ function deepClone(obj) {
|
|||||||
*/
|
*/
|
||||||
function deepMerge(target = {}, source = {}) {
|
function deepMerge(target = {}, source = {}) {
|
||||||
target = deepClone(target)
|
target = deepClone(target)
|
||||||
if (typeof target !== 'object' || typeof source !== 'object') return false
|
if (typeof target !== 'object' || target === null || typeof source !== 'object' || source === null) return target;
|
||||||
|
const merged = Array.isArray(target) ? target.slice() : Object.assign({}, target);
|
||||||
for (const prop in source) {
|
for (const prop in source) {
|
||||||
if (!source.hasOwnProperty(prop)) continue
|
if (!source.hasOwnProperty(prop)) continue;
|
||||||
if (prop in target) {
|
const sourceValue = source[prop];
|
||||||
if (typeof target[prop] !== 'object') {
|
const targetValue = merged[prop];
|
||||||
target[prop] = source[prop]
|
if (sourceValue instanceof Date) {
|
||||||
} else if (typeof source[prop] !== 'object') {
|
merged[prop] = new Date(sourceValue);
|
||||||
target[prop] = source[prop]
|
} else if (sourceValue instanceof RegExp) {
|
||||||
} else if (target[prop].concat && source[prop].concat) {
|
merged[prop] = new RegExp(sourceValue);
|
||||||
target[prop] = target[prop].concat(source[prop])
|
} else if (sourceValue instanceof Map) {
|
||||||
} else {
|
merged[prop] = new Map(sourceValue);
|
||||||
target[prop] = deepMerge(target[prop], source[prop])
|
} else if (sourceValue instanceof Set) {
|
||||||
}
|
merged[prop] = new Set(sourceValue);
|
||||||
|
} else if (typeof sourceValue === 'object' && sourceValue !== null) {
|
||||||
|
merged[prop] = deepMerge(targetValue, sourceValue);
|
||||||
} else {
|
} else {
|
||||||
target[prop] = source[prop]
|
merged[prop] = sourceValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return target
|
return merged;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -327,7 +342,7 @@ if (!String.prototype.padStart) {
|
|||||||
/**
|
/**
|
||||||
* @description 时间戳转为多久之前
|
* @description 时间戳转为多久之前
|
||||||
* @param {String|Number} timestamp 时间戳
|
* @param {String|Number} timestamp 时间戳
|
||||||
* @param {String|Boolean} format
|
* @param {String|Boolean} format
|
||||||
* 格式化规则如果为时间格式字符串,超出一定时间范围,返回固定的时间格式;
|
* 格式化规则如果为时间格式字符串,超出一定时间范围,返回固定的时间格式;
|
||||||
* 如果为布尔值false,无论什么时间,都返回多久以前的格式
|
* 如果为布尔值false,无论什么时间,都返回多久以前的格式
|
||||||
* @returns {string} 转化后的内容
|
* @returns {string} 转化后的内容
|
||||||
@@ -517,7 +532,7 @@ function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparato
|
|||||||
while (re.test(s[0])) {
|
while (re.test(s[0])) {
|
||||||
s[0] = s[0].replace(re, `$1${sep}$2`)
|
s[0] = s[0].replace(re, `$1${sep}$2`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((s[1] || '').length < prec) {
|
if ((s[1] || '').length < prec) {
|
||||||
s[1] = s[1] || ''
|
s[1] = s[1] || ''
|
||||||
s[1] += new Array(prec - s[1].length + 1).join('0')
|
s[1] += new Array(prec - s[1].length + 1).join('0')
|
||||||
@@ -531,7 +546,7 @@ function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparato
|
|||||||
* 比如以30位阈值,那么300大于30,可以理解为用户想要的是300ms,而不是想花300s去执行一个动画
|
* 比如以30位阈值,那么300大于30,可以理解为用户想要的是300ms,而不是想花300s去执行一个动画
|
||||||
* @param {String|number} value 比如: "1s"|"100ms"|1|100
|
* @param {String|number} value 比如: "1s"|"100ms"|1|100
|
||||||
* @param {boolean} unit 提示: 如果是false 默认返回number
|
* @param {boolean} unit 提示: 如果是false 默认返回number
|
||||||
* @return {string|number}
|
* @return {string|number}
|
||||||
*/
|
*/
|
||||||
function getDuration(value, unit = true) {
|
function getDuration(value, unit = true) {
|
||||||
const valueNum = parseInt(value)
|
const valueNum = parseInt(value)
|
||||||
@@ -650,6 +665,16 @@ function pages() {
|
|||||||
return pages
|
return pages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取页面历史栈指定层实例
|
||||||
|
* @param back {number} [0] - 0或者负数,表示获取历史栈的哪一层,0表示获取当前页面实例,-1 表示获取上一个页面实例。默认0。
|
||||||
|
*/
|
||||||
|
function getHistoryPage(back = 0) {
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
const len = pages.length
|
||||||
|
return pages[len - 1 + back]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 修改uView内置属性值
|
* @description 修改uView内置属性值
|
||||||
* @param {object} props 修改内置props属性
|
* @param {object} props 修改内置props属性
|
||||||
@@ -701,5 +726,6 @@ export default {
|
|||||||
setProperty,
|
setProperty,
|
||||||
page,
|
page,
|
||||||
pages,
|
pages,
|
||||||
|
getHistoryPage,
|
||||||
setConfig
|
setConfig
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"id": "uview-ui",
|
"id": "uview-ui",
|
||||||
"name": "uview-ui",
|
"name": "uview-ui",
|
||||||
"displayName": "uView2.0重磅发布,利剑出鞘,一统江湖",
|
"displayName": "uView2.0重磅发布,利剑出鞘,一统江湖",
|
||||||
"version": "2.0.35",
|
"version": "2.0.36",
|
||||||
"description": "uView UI已完美兼容nvue,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
|
"description": "uView UI已完美兼容nvue,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"uview",
|
"uview",
|
||||||
@@ -17,12 +17,8 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"HBuilderX": "^3.1.0"
|
"HBuilderX": "^3.1.0"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
"category": [
|
"sale": {
|
||||||
"前端组件",
|
|
||||||
"通用组件"
|
|
||||||
],
|
|
||||||
"sale": {
|
|
||||||
"regular": {
|
"regular": {
|
||||||
"price": "0.00"
|
"price": "0.00"
|
||||||
},
|
},
|
||||||
@@ -38,7 +34,8 @@
|
|||||||
"data": "无",
|
"data": "无",
|
||||||
"permissions": "无"
|
"permissions": "无"
|
||||||
},
|
},
|
||||||
"npmurl": "https://www.npmjs.com/package/uview-ui"
|
"npmurl": "https://www.npmjs.com/package/uview-ui",
|
||||||
|
"type": "component-vue"
|
||||||
},
|
},
|
||||||
"uni_modules": {
|
"uni_modules": {
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
|
|||||||
Reference in New Issue
Block a user