访问 不到页面时 会出现404 的现象
1、首先要建设一个H404.vue 的文件夹项目
2、rnaho8u要在路由里 配置访问路由路径
import H404 from '../views/H404.vue'
总代码:
<template>
<div>
<div class="h404-con">
<!-- 只要我们访问的文件不在 这个项目中 则自动会跳转到 404 页面 -->
<h1 class="hello">404 页面没找到 ! ! ! !</h1>
</div>
</div>
</template>
<script>
export default {
name: 'H404',
data() {
return {
};
},
mounted() {
},
methods: {
},
};
</script>
<style lang="scss" scoped>
.h404-con{
background-color: #d2f5f1;
width: 100%;
height: 100vh;
}
.hello{
font-size: 60px;
text-align: center;
color: mediumpurple;
position: absolute;
top: 50%;
left: 50%;
margin-left: -300px;
margin-top: -40px;
}
</style>
预览效果: