Vue更新文件后刷新页面

router.onError(error => {
  const pattern = /Loading chunk/g;
  const isChunkLoadFailed = error.message.match(pattern);
  const targetPath = router.history.pending.fullPath;
  if (isChunkLoadFailed) {
    window.history.replaceState({}, document.title, targetPath);
    window.location.reload();
  }
});

猜你喜欢

转载自www.cnblogs.com/tujw/p/12368750.html