BUG 25647
This commit is contained in:
@@ -33,7 +33,6 @@ const calcAge = (code) => {
|
||||
return Math.ceil($moment().year() - $moment(birthday).year())
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
dict,
|
||||
confirm,
|
||||
@@ -52,5 +51,27 @@ export default {
|
||||
},
|
||||
hideLoading: () => {
|
||||
uni.hideLoading()
|
||||
},
|
||||
colorUtils: {
|
||||
Hex2RGBA(color, alpha = 1) {
|
||||
let hex = 0;
|
||||
if (color.charAt(0) == "#") {
|
||||
if (color.length == 4) {
|
||||
//检测诸如#FFF简写格式
|
||||
color = "#" + color.charAt(1).repeat(2) +
|
||||
color.charAt(2).repeat(2) +
|
||||
color.charAt(3).repeat(2);
|
||||
}
|
||||
hex = parseInt(color.slice(1), 16);
|
||||
}
|
||||
let r = hex >> 16 & 0xFF;
|
||||
let g = hex >> 8 & 0xFF;
|
||||
let b = hex & 0xFF;
|
||||
return `rgba(${r},${g},${b},${alpha})`;
|
||||
},
|
||||
RGBtoHex(r, g, b) {
|
||||
let hex = r << 16 | g << 8 | b;
|
||||
return "#" + hex.toString(16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user