npm install
npm run serve
npm run build
npm run test
npm run lint
- 先添加
404.html
页面
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<script>
sessionStorage.redirect = location.href;
</script>
<meta http-equiv="refresh" content="0;URL='/'"/>
</head>
<body>
</body>
</html>
- 在
index.html
中添加下面的代码
// 这段代码要放在其他js的前面
(function(){
const redirect = sessionStorage.redirect;
delete sessionStorage.redirect;
if (redirect && redirect !== location.href) {
history.replaceState(null, null, redirect);
}
})();