35 lines
1.3 KiB
HTML
35 lines
1.3 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>造价计算工具</title>
|
|
</head>
|
|
<body>
|
|
<div id="app"></div>
|
|
<script>
|
|
//上线前添加访问版本号,强制刷新缓存
|
|
;(() => {
|
|
const makeVisitVersion = () => {
|
|
if (window.crypto && typeof window.crypto.getRandomValues === 'function') {
|
|
const bytes = new Uint32Array(2)
|
|
window.crypto.getRandomValues(bytes)
|
|
return `${Date.now().toString(36)}-${bytes[0].toString(36)}${bytes[1].toString(36)}`
|
|
}
|
|
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`
|
|
}
|
|
|
|
const url = new URL(window.location.href)
|
|
url.searchParams.set('v', makeVisitVersion())
|
|
const nextUrl = `${url.pathname}${url.search}${url.hash}`
|
|
const currentUrl = `${window.location.pathname}${window.location.search}${window.location.hash}`
|
|
if (nextUrl !== currentUrl) {
|
|
window.history.replaceState(null, '', nextUrl)
|
|
}
|
|
})()
|
|
</script>
|
|
<script type="module" src="/src/main.ts"></script>
|
|
</body>
|
|
</html>
|