mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: 优化代码
This commit is contained in:
parent
834ccaa35b
commit
77d29471a1
|
|
@ -47,12 +47,16 @@ export const defaultPlatformSetting = {
|
|||
projectUrl: 'https://github.com/1Panel-dev/MaxKB'
|
||||
}
|
||||
|
||||
export function hexToRgba(hex: string, alpha: number) {
|
||||
export function hexToRgba(hex?: string, alpha?: number) {
|
||||
// 将16进制颜色值的两个字符一起转换成十进制
|
||||
const r = parseInt(hex.slice(1, 3), 16)
|
||||
const g = parseInt(hex.slice(3, 5), 16)
|
||||
const b = parseInt(hex.slice(5, 7), 16)
|
||||
if (!hex) {
|
||||
return ''
|
||||
} else {
|
||||
const r = parseInt(hex.slice(1, 3), 16)
|
||||
const g = parseInt(hex.slice(3, 5), 16)
|
||||
const b = parseInt(hex.slice(5, 7), 16)
|
||||
|
||||
// 返回RGBA格式的字符串
|
||||
return `rgba(${r}, ${g}, ${b}, ${alpha})`
|
||||
// 返回RGBA格式的字符串
|
||||
return `rgba(${r}, ${g}, ${b}, ${alpha})`
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@
|
|||
/>
|
||||
<img
|
||||
v-else
|
||||
src="/ui/public/MaxKB.gif"
|
||||
src="/MaxKB.gif"
|
||||
height="50px"
|
||||
style="width: 40px; height: 40px; display: block"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue