vue 404页面

article/2025/9/16 18:52:00

一、概述

如果用户输入错误的网址没有提示,界面也不会有任何变化,用户体验非常不友好,所以需要设置错误提示

二、设置

设置404页面需要在配置路由文件index.js中设置,其中 '*' 代表的就是404页面

// 404 page must be placed at the end !!!
{path: '*',component: () => import('@/views/Layout/components/404'),
},

views/Layout/components/404.vue

<template><div class="wscn-http404-container"><div class="wscn-http404"><div class="pic-404"><img class="pic-404__parent" src="@/assets/404_images/404.png" alt="404"><img class="pic-404__child left" src="@/assets/404_images/404_cloud.png" alt="404"><img class="pic-404__child mid" src="@/assets/404_images/404_cloud.png" alt="404"><img class="pic-404__child right" src="@/assets/404_images/404_cloud.png" alt="404"></div><div class="bullshit"><div class="bullshit__oops">OOPS!</div><div class="bullshit__info">All rights reserved<a style="color:#20a0ff" href="https://wallstreetcn.com" target="_blank">wallstreetcn</a></div><div class="bullshit__headline">{{ message }}</div><div class="bullshit__info">Please check that the URL you entered is correct, or click the button below to return to the homepage.</div><a href="" class="bullshit__return-home">Back to home</a></div></div></div>
</template><script>export default {name: 'Page404',computed: {message() {return 'The webmaster said that you can not enter this page...'}}
}
</script><style lang="scss" scoped>
.wscn-http404-container{transform: translate(-50%,-50%);position: absolute;top: 40%;left: 50%;
}
.wscn-http404 {position: relative;width: 1200px;padding: 0 50px;overflow: hidden;.pic-404 {position: relative;float: left;width: 600px;overflow: hidden;&__parent {width: 100%;}&__child {position: absolute;&.left {width: 80px;top: 17px;left: 220px;opacity: 0;animation-name: cloudLeft;animation-duration: 2s;animation-timing-function: linear;animation-fill-mode: forwards;animation-delay: 1s;}&.mid {width: 46px;top: 10px;left: 420px;opacity: 0;animation-name: cloudMid;animation-duration: 2s;animation-timing-function: linear;animation-fill-mode: forwards;animation-delay: 1.2s;}&.right {width: 62px;top: 100px;left: 500px;opacity: 0;animation-name: cloudRight;animation-duration: 2s;animation-timing-function: linear;animation-fill-mode: forwards;animation-delay: 1s;}@keyframes cloudLeft {0% {top: 17px;left: 220px;opacity: 0;}20% {top: 33px;left: 188px;opacity: 1;}80% {top: 81px;left: 92px;opacity: 1;}100% {top: 97px;left: 60px;opacity: 0;}}@keyframes cloudMid {0% {top: 10px;left: 420px;opacity: 0;}20% {top: 40px;left: 360px;opacity: 1;}70% {top: 130px;left: 180px;opacity: 1;}100% {top: 160px;left: 120px;opacity: 0;}}@keyframes cloudRight {0% {top: 100px;left: 500px;opacity: 0;}20% {top: 120px;left: 460px;opacity: 1;}80% {top: 180px;left: 340px;opacity: 1;}100% {top: 200px;left: 300px;opacity: 0;}}}}.bullshit {position: relative;float: left;width: 300px;padding: 30px 0;overflow: hidden;&__oops {font-size: 32px;font-weight: bold;line-height: 40px;color: #1482f0;opacity: 0;margin-bottom: 20px;animation-name: slideUp;animation-duration: 0.5s;animation-fill-mode: forwards;}&__headline {font-size: 20px;line-height: 24px;color: #222;font-weight: bold;opacity: 0;margin-bottom: 10px;animation-name: slideUp;animation-duration: 0.5s;animation-delay: 0.1s;animation-fill-mode: forwards;}&__info {font-size: 13px;line-height: 21px;color: grey;opacity: 0;margin-bottom: 30px;animation-name: slideUp;animation-duration: 0.5s;animation-delay: 0.2s;animation-fill-mode: forwards;}&__return-home {display: block;float: left;width: 110px;height: 36px;background: #1482f0;border-radius: 100px;text-align: center;color: #ffffff;opacity: 0;font-size: 14px;line-height: 36px;cursor: pointer;animation-name: slideUp;animation-duration: 0.5s;animation-delay: 0.3s;animation-fill-mode: forwards;}@keyframes slideUp {0% {transform: translateY(60px);opacity: 0;}100% {transform: translateY(0);opacity: 1;}}}
}
</style>
View Code

进入src/assets,创建目录404_images,里面放2张图片,图片下载地址:

https://github.com/PanJiaChen/vue-element-admin/tree/master/src/assets/404_images

访问404页面,效果如下:

本文参考链接:

https://blog.csdn.net/weixin_39168052/article/details/81326805


http://chatgpt.dhexx.cn/article/ljv4ZW1T.shtml

相关文章

自适应404页面

404.CSS *{ padding:0;margin:0;box-sizing:border-box;font-family:"微软雅黑";} body,html{width:100%;height:100%;} .container{max-width:90%;margin:0 auto;padding:80px 0px; } img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;us…

什么是404页面,404有什么做用,网站做404有什么好处?

什么是404页面&#xff1f; 404页面是客户端在浏览网页时&#xff0c;服务器无法正常提供信息&#xff0c;又不知情况&#xff0c;所返回的页面。很多用户访问错误网页时就会经常出现这个404页面。 所谓404页面主要指的是在运营网站的过程中&#xff0c;当用户点击了某个网页…

网页报错404原因及解决方法

网页报错404&#xff1a;即找不到该资源 未开启服务 若使用的是tomcat服务器&#xff0c;先检查服务器有没有正常启动&#xff0c;网络连接是否正常。 服务器未正确部署 使用开发工具为idea&#xff0c;检查tomcat在idea是否部署正确。 服务器配置出错 tomcat在idea中的配置出错…

404是什么意思,404错误页面有什么用?

在我们浏览网页时&#xff0c;时常会出现一些404页面&#xff0c;导致无法正常浏览网页&#xff0c;那么什么是404呢&#xff0c;为什么会产生404页面呢&#xff1f;下面我们一起来看看。 404介绍 404其实是一种http状态码&#xff0c;代表用户在浏览网页时&#xff0c;服务器…

自制整人电脑小程序

自制整人电脑小程序&#xff0c;有趣的.vbs文件 今天看到一个有意思小程序&#xff0c;可以用来整蛊好朋友&#xff0c;让他们以为电脑收到攻击或者重要文件丢失。制作这个小程序只需要用到电脑最普通的文本文档&#xff0c;只是保存格式不是常用的.txt&#xff0c;而是.vbs。…

删好友警告,C语言最强整人小程序!(勿随便使用)

整人啦!!! 小编一共给你们准备了三个,分别起名为关机、死机、抖动,都给出了代码,大家仅仅用来娱乐,不要乱来哦。。。 注意:如果你用了感到生气的话不要怪小编哦,大家慎用!!! 关机小程序 #include<stdio.h> #include<string.h> #include<stdlib.h&…

C语言丨整蛊必备小程序,好玩炸翻天(附源码)

前言 感觉学了c语言后仍然一无是处&#xff1f;&#xff01;&#xff01;想要整蛊一下朋友仍然不会&#xff1f;&#xff01;&#xff01; 别慌&#xff0c;看完这篇文章&#xff0c;你就会了。 下面给大家分享两个基础的整蛊小程序 1.我是猪关机程序 2.无限弹窗程序 一、…

cmd整人小程序(e~~,不要乱用)

这些程序均用cmd使用 *使用方法&#xff1a;1.新建一个TXT文档 2.打开控制面板 3.打开文件管理器 4.取消隐藏文件夹 5.后缀txt改成bat 6.点击即可 1.叫爸爸程序 用shutdown / t xx /s 制作。直接贴程序。echo off&color 0e&mode con cols47 lines20 setlocal enable…

C#窗体之整人小程序

今天在人人上看到一个好玩的gif图,是这样的 看着挺好玩。这典型的C#中监听鼠标各种事件的例子。当然不是说只能用C#做。语言无界限嘛。 首先拖一个按钮上去,改文字,然后给这个按钮加上监听让它弹出来一个对话框,平常总是用messagebox。要是java语言的话这会就得继承对话框自…

计算机代码坑人小程序bat,运用bat写的整人小程序有哪些?

满意答案 yuj16sv56 推荐于 2017.05.26 采纳率&#xff1a;55% 等级&#xff1a;9 已帮助&#xff1a;3865人 echo off&color 0e&mode con cols47 lines20 setlocal enabledelayedexpansion echo 哈哈&#xff0c;你中招了- -。 echo 小提示&#xff1a;按CTRL空格,…

如何用c语言写一个简答的整人小程序

#include <stdio.h> #include <process.h> #include <string.h> int main() {printf("你的电脑将在60秒后关机,请输入 我是猪 取消关机\n");system("shutdown -s -t 60");char input[20] { 0 };scanf("%s", input);while (1)…

c语言程序设计整人,C语言进程间通信练习作品 - 整人小程序之剪切板

主程序界面&#xff1a; 程序介绍&#xff1a; 如果对方执行了主程序生成的【server.exe】&#xff0c;【server.exe】会自复制、自启动、自删除(仿木马)。 【server.exe】会后台每秒/次检测对方的剪切板&#xff0c;一有文本数据则在尾部加入【附加内容】&#xff0c;达到&am…

QT整人小程序

想起以前在网上看到一个好玩有趣的整人小程序 我用QT进行了复现&#xff0c;之前也看了用C#进行复现的大佬的文章&#xff1a; C#复现 我的复现 可以直接下载源码看&#xff0c;我的环境是UBUNTU 16.04 GCC 64 bit。

C语言整人小程序,慎用,谨记!

整人啦&#xff01;&#xff01;&#xff01; 哈喽~ 今天有位朋友留言问有没有比较有趣的C语言小程序&#xff1f; 想了想&#xff0c;给你写几个整人的小程序吧&#xff0c;有趣又好玩。。。 这里一共给你们准备了三个&#xff0c;分别起名为关机、死机、抖动&#xff0c;都给…

抖音上非常火的整人小程序

最近&#xff0c;抖音上的整人小程序深得刷客恩宠。今天小编就为大家献上源代码&#xff1a; 直接上效果图 这里&#xff0c;只有她输入“我是猪”&#xff0c;并且按下确定的时候&#xff0c;才能继续...否则将一直停留在这个页面&#xff0c;并且关不掉。 注意&#xff1a;…

Nessus: 漏洞扫描器-网络取证工具

Nessue 要理解网络漏洞攻击&#xff0c;应该理解攻击者不是单独攻击&#xff0c;而是组合攻击。因此&#xff0c;本文介绍了关于Nessus历史的研究&#xff0c;它是什么以及它如何与插件一起工作。研究了Nessus的特点&#xff0c;使其成为网络取证中非常推荐的网络漏洞扫描工具…

【漏洞软件扫描】

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、简介二、竞赛1、开启题目2.点击此处获得3、复制Flag 三、比赛形式1、开启题目2、点击此处获得3、复制Flag 四、题目类型1、开启题目2、点击此处获得3、复制…

漏洞扫描的原理

漏洞扫描是指通过自动或者手动的方式&#xff0c;对系统进行全面扫描&#xff0c;发现系统中存在的漏洞。随着互联网的发展&#xff0c;漏洞扫描的重要性越来越凸显&#xff0c;因为漏洞一旦被黑客利用&#xff0c;就可能会导致系统被攻击、数据被窃取等问题。那么什么是漏洞扫…

2020年漏洞扫描工具Top10

在本文中&#xff0c;我们将介绍市场上可用的十大最佳漏洞扫描工具。 OpenVAS Tripwire IP360 Nessus Comodo HackerProof Nexpose community Vulnerability Manager Plus Nikto Wireshark Aircrack-ng Retina 1.OpenVAS OpenVAS漏洞扫描器是一种漏洞分析工具&#…

漏洞扫描器 XRAY

文章目录 XRAY简介XRAY安装XRAY使用爬虫模式被动扫描生成 ca 证书开启监听浏览器设置代理访问网站自动探测漏洞 BurpSuite联动XRAYxray 开启端口监听burpsuite 设置通过burp suite 访问网站 https://github.com/chaitin/xray XRAY简介 xray 是一款功能强大的安全评估工具&#…