個(gè)人主頁(yè)怎么設(shè)置企業(yè)網(wǎng)站seo優(yōu)化公司
1、背景
?前端開(kāi)發(fā)經(jīng)常遇到輸入路徑不存在的問(wèn)題,為此,把之前項(xiàng)目的404拿出來(lái)供大家參考。代碼很簡(jiǎn)單,適合新手入手,效果如下:
2、代碼引用的是element-plus框架
<template><div><el-result icon="warning" title="404提示" sub-title="你找的頁(yè)面不存在,點(diǎn)擊下方按鈕回家~"><template #extra><el-button type="primary" @click="$router.push('/')">回到home頁(yè)</el-button></template></el-result></div>
</template>
3、路由配置
import { createRouter, createWebHashHistory } from 'vue-router'import Index from '~/pages/index.vue'
import NOTFOUND from '~/pages/404.vue'const routes = [{path: "/",component: Index,
}, {path: '/:pathMatch(.*)*',name: 'NOTFOUND',component: NOTFOUND
}]const router = createRouter({history: createWebHashHistory(),routes
})export default router