vue3 自定义404界面
设置路径在我们的router下的index.js中添加如下路径即可{path: '/:cathchAll(.*)',name: '404',component: () => import('../views/404.vue')},自定义404界面在我们的404.vue文件中放一个我们想要的文件即可<template><div class="not-found"><
·
设置路径
在我们的router下的index.js中添加如下路径即可
{
path: '/:cathchAll(.*)',
name: '404',
component: () => import('../views/404.vue')
},
自定义404界面
在我们的404.vue文件中放一个我们想要的图片文件
<template>
<div class="not-found">
<img src="../assets/404.gif" alt="" />
</div>
</template>
<script>
export default {
name: '404',
components: {}
}
</script>
<style scoped>
.not-found {
width: 100%;
height: 100%;
overflow: hidden;
}
.not-found img {
width: 100%;
height: 100%;
}
</style>>
图片在此 要的小伙伴自取哦

这样一个巧妙的自定义404就完成啦
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)