@ithinkdt/core
Version:
iThinkDT Core
20 lines (17 loc) • 547 B
JavaScript
import { nextTick } from 'vue'
export const config = {
prefix: '',
}
export function setTitle(title, auth, pageTab) {
if (pageTab) {
pageTab.title = title?.trim() || undefined
}
nextTick(() => {
let t = (title || auth.activedModulePath.at(-1)?.label || '').trim()
if (auth.activedModulePath.at(-1)) {
auth.activedModulePath.at(-1)._label = t
}
t = t ? t + ' - ' : ''
document.title = (config.prefix || '') + t + (auth.app?.appTitle ?? auth.app?.appName ?? '')
})
}