代码

<template>
    <div class="wrapper-page">
        <div class="page-ex">
            <h1>{{errorCode}}</h1>
            <h2>{{ title }}</h2><br>
            <p>{{ message }}</p>
            <br>
            <a class="page-back" :href="redirect">{{ primaryBtnText }}</a>
        </div>
	</div>
</template>
 
<script>
	export default {
		name: "PageError",
		computed: {
      errorCode() {
        return  this.params.errorCode || 500
      },
      title() {
        return this.params.title || "出错了!"
      },
      message() {
				return this.params.message || '抱歉,出错了';
			},
      primaryBtnText() {
        return this.params.primaryBtnText || '回到首页';
      },
      redirect() {
        return  this.params.redirect || ''
      },
      params() {
        return this.$router.currentRoute.query
      }
		},
		methods: {
			logout() {
				this.$store.dispatch("user/logout", this);
			}
		}
	};
</script>
 
<style lang="scss">
  body {
    background:#f5f5f5;
  }
</style>
 
<style lang="scss" scoped>
.wrapper-page {
  transform: translate(-50%, -50%);
  position: absolute;
  top: 40%;
  left: 50%;
  text-align: center;
  line-height: 1;
  font-size: 14px;
}
.page-ex h1 {
  font-size: 98px;
  line-height: 150px;
  font-weight: 700;
  color: #252932;
  margin: 10px 0;
  text-shadow:
    rgba(61, 61, 61, 0.3) 1px 1px,
    rgba(61, 61, 61, 0.2) 2px 2px,
    rgba(61, 61, 61, 0.3) 3px 3px;
}
.page-ex h2 {
  font-size: 30px;
  color: #E6454A;
  line-height: 35px;
  margin: 10px 0;
}
.page-ex p {
  font-size: 14px;
  color: #505458;
  margin: 0 0 10px;
}
 
.page-back {
  min-width: 120px;
  background-color: #E6454A;
  color: #fff;
  letter-spacing: 0.2px;
  opacity: 0.93;
  display: inline-block;
  padding: 8px 12px;
  margin-bottom: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.42857143;
  text-align: center;
  border: 1px solid transparent;
  border-radius: 4px;
  text-decoration: none;
  -webkit-transition: all 0.3s ease-out;
  -moz-transition: all 0.3s ease-out;
  -o-transition: all 0.3s ease-out;
  -ms-transition: all 0.3s ease-out;
  transition: all 0.3s ease-out;
}
</style>

效果

扩展阅读