fix: substr deprecated
parent
fa1af5e7c6
commit
a7f7a9e0b8
|
@ -74,7 +74,7 @@ export const bindHandlers = (initEvent: Event, listeners: any, editor: any): voi
|
||||||
if (key === 'onInit') {
|
if (key === 'onInit') {
|
||||||
handler(initEvent, editor)
|
handler(initEvent, editor)
|
||||||
} else {
|
} else {
|
||||||
editor.on(key.substring(2), (e: any) => handler(e, editor))
|
editor.on(key.slice(2), (e: any) => handler(e, editor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -358,9 +358,9 @@ export default defineComponent({
|
||||||
|
|
||||||
const titleDom = isHighlight ? (
|
const titleDom = isHighlight ? (
|
||||||
<span class={unref(getBindValues)?.blockNode ? `${bem('content')}` : ''}>
|
<span class={unref(getBindValues)?.blockNode ? `${bem('content')}` : ''}>
|
||||||
<span>{title.substr(0, searchIdx)}</span>
|
<span>{title.slice(0, searchIdx)}</span>
|
||||||
<span style={highlightStyle}>{searchText}</span>
|
<span style={highlightStyle}>{searchText}</span>
|
||||||
<span>{title.substr(searchIdx + (searchText as string).length)}</span>
|
<span>{title.slice(searchIdx + (searchText as string).length)}</span>
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
title
|
title
|
||||||
|
|
|
@ -19,7 +19,7 @@ export function genMessage(langs: Record<string, Record<string, any>>, prefix =
|
||||||
const langFileModule = langs[key].default
|
const langFileModule = langs[key].default
|
||||||
let fileName = key.replace(`./${prefix}/`, '').replace(/^\.\//, '')
|
let fileName = key.replace(`./${prefix}/`, '').replace(/^\.\//, '')
|
||||||
const lastIndex = fileName.lastIndexOf('.')
|
const lastIndex = fileName.lastIndexOf('.')
|
||||||
fileName = fileName.substring(0, lastIndex)
|
fileName = fileName.slice(0, lastIndex)
|
||||||
const keyList = fileName.split('/')
|
const keyList = fileName.split('/')
|
||||||
const moduleName = keyList.shift()
|
const moduleName = keyList.shift()
|
||||||
const objKey = keyList.join('.')
|
const objKey = keyList.join('.')
|
||||||
|
|
|
@ -92,7 +92,7 @@ export function scriptErrorHandler(event: Event | string, source?: string, linen
|
||||||
} else {
|
} else {
|
||||||
errorInfo.stack = ''
|
errorInfo.stack = ''
|
||||||
}
|
}
|
||||||
const name = source ? source.substr(source.lastIndexOf('/') + 1) : 'script'
|
const name = source ? source.slice(source.lastIndexOf('/') + 1) : 'script'
|
||||||
const errorLogStore = useErrorLogStoreWithOut()
|
const errorLogStore = useErrorLogStoreWithOut()
|
||||||
errorLogStore.addErrorLogInfo({
|
errorLogStore.addErrorLogInfo({
|
||||||
type: ErrorTypeEnum.SCRIPT,
|
type: ErrorTypeEnum.SCRIPT,
|
||||||
|
|
|
@ -91,7 +91,7 @@ export function configureDynamicParamsMenu(menu: Menu, params: RouteParams) {
|
||||||
const matchArr = realPath.match(menuParamRegex)
|
const matchArr = realPath.match(menuParamRegex)
|
||||||
|
|
||||||
matchArr?.forEach((it) => {
|
matchArr?.forEach((it) => {
|
||||||
const realIt = it.substr(1)
|
const realIt = it.slice(1)
|
||||||
if (params[realIt]) {
|
if (params[realIt]) {
|
||||||
realPath = realPath.replace(`:${realIt}`, params[realIt] as string)
|
realPath = realPath.replace(`:${realIt}`, params[realIt] as string)
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ function dynamicImport(dynamicViewsModules: Record<string, () => Promise<Recorda
|
||||||
const endFlag = component.endsWith('.vue') || component.endsWith('.tsx')
|
const endFlag = component.endsWith('.vue') || component.endsWith('.tsx')
|
||||||
const startIndex = startFlag ? 0 : 1
|
const startIndex = startFlag ? 0 : 1
|
||||||
const lastIndex = endFlag ? k.length : k.lastIndexOf('.')
|
const lastIndex = endFlag ? k.length : k.lastIndexOf('.')
|
||||||
return k.substring(startIndex, lastIndex) === component
|
return k.slice(startIndex, lastIndex) === component
|
||||||
})
|
})
|
||||||
if (matchKeys?.length === 1) {
|
if (matchKeys?.length === 1) {
|
||||||
const matchKey = matchKeys[0]
|
const matchKey = matchKeys[0]
|
||||||
|
|
|
@ -65,10 +65,10 @@ export function colorIsDark(color: string) {
|
||||||
* @returns {string} The HEX representation of the processed color
|
* @returns {string} The HEX representation of the processed color
|
||||||
*/
|
*/
|
||||||
export function darken(color: string, amount: number) {
|
export function darken(color: string, amount: number) {
|
||||||
color = color.indexOf('#') >= 0 ? color.substring(1, color.length) : color
|
color = color.indexOf('#') >= 0 ? color.slice(1, color.length) : color
|
||||||
amount = Math.trunc((255 * amount) / 100)
|
amount = Math.trunc((255 * amount) / 100)
|
||||||
return `#${subtractLight(color.substring(0, 2), amount)}${subtractLight(color.substring(2, 4), amount)}${subtractLight(
|
return `#${subtractLight(color.slice(0, 2), amount)}${subtractLight(color.slice(2, 4), amount)}${subtractLight(
|
||||||
color.substring(4, 6),
|
color.slice(4, 6),
|
||||||
amount
|
amount
|
||||||
)}`
|
)}`
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,9 @@ export function darken(color: string, amount: number) {
|
||||||
* @returns {string} The processed color represented as HEX
|
* @returns {string} The processed color represented as HEX
|
||||||
*/
|
*/
|
||||||
export function lighten(color: string, amount: number) {
|
export function lighten(color: string, amount: number) {
|
||||||
color = color.indexOf('#') >= 0 ? color.substring(1, color.length) : color
|
color = color.indexOf('#') >= 0 ? color.slice(1, color.length) : color
|
||||||
amount = Math.trunc((255 * amount) / 100)
|
amount = Math.trunc((255 * amount) / 100)
|
||||||
return `#${addLight(color.substring(0, 2), amount)}${addLight(color.substring(2, 4), amount)}${addLight(color.substring(4, 6), amount)}`
|
return `#${addLight(color.slice(0, 2), amount)}${addLight(color.slice(2, 4), amount)}${addLight(color.slice(4, 6), amount)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Suma el porcentaje indicado a un color (RR, GG o BB) hexadecimal para aclararlo */
|
/* Suma el porcentaje indicado a un color (RR, GG o BB) hexadecimal para aclararlo */
|
||||||
|
@ -126,7 +126,7 @@ function contrast(rgb1: string[], rgb2: number[]) {
|
||||||
* @param hexColor - Last selected color by the user
|
* @param hexColor - Last selected color by the user
|
||||||
*/
|
*/
|
||||||
export function calculateBestTextColor(hexColor: string) {
|
export function calculateBestTextColor(hexColor: string) {
|
||||||
const rgbColor = hexToRGB(hexColor.substring(1))
|
const rgbColor = hexToRGB(hexColor.slice(1))
|
||||||
const contrastWithBlack = contrast(rgbColor.split(','), [0, 0, 0])
|
const contrastWithBlack = contrast(rgbColor.split(','), [0, 0, 0])
|
||||||
|
|
||||||
return contrastWithBlack >= 12 ? '#000000' : '#FFFFFF'
|
return contrastWithBlack >= 12 ? '#000000' : '#FFFFFF'
|
||||||
|
|
|
@ -69,7 +69,7 @@ export function downloadByUrl({ url, target = '_blank', fileName }: { url: strin
|
||||||
link.target = target
|
link.target = target
|
||||||
|
|
||||||
if (link.download !== undefined) {
|
if (link.download !== undefined) {
|
||||||
link.download = fileName || url.substring(url.lastIndexOf('/') + 1, url.length)
|
link.download = fileName || url.slice(url.lastIndexOf('/') + 1, url.length)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.createEvent) {
|
if (document.createEvent) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
title: '绑定域名',
|
title: '绑定域名',
|
||||||
dataIndex: 'domain',
|
dataIndex: 'domain',
|
||||||
width: 120
|
width: 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '租户状态',
|
title: '租户状态',
|
||||||
|
|
Loading…
Reference in New Issue