router.onError((error) => {
if (import.meta.env.PROD && error.message.startsWith('Failed to fetch dynamically imported module')) {
const { createConfirm } = useMessage()
createConfirm({
title: '网页内容已经更新,请点击下面的按钮刷新页面。',
iconType: 'warning',
centered: true,
okText: '刷新',
cancelText: '取消',
onOk() {
window.location.reload()
},
onCancel() {
console.log('Cancel')
}
})
}
})
vue3+vite打包部署后提示用户手动刷新页面
最新推荐文章于 2025-04-21 09:52:07 发布