Files
land-vue-frontend/src/utils/change-title.ts
2026-04-10 00:41:21 +03:00

20 lines
567 B
TypeScript

import type { Ref } from 'vue'
const sleep = (ms: number) => new Promise((res) => setTimeout(res, ms))
export async function ChangeTitle(refvar: Ref, old_string: string, new_string: string) {
const old_array = old_string.split(' ')
const new_array = new_string.split(' ')
for (let i = old_array.length; i >= 0; i -= 1) {
refvar.value = old_array.slice(0, i).join(' ')
await sleep(100)
}
for (let i = 0; i < new_array.length; i++) {
refvar.value = new_array.slice(0, i + 1).join(' ')
await sleep(100)
}
// refvar.value = new_string
}