1. 程式人生 > >Vue 建立 404 頁面【超級簡單】

Vue 建立 404 頁面【超級簡單】

目的:在vue專案中,新增一個 404 頁面。

 

具體效果,可以去這個網站測試      http://www.xdx97.com

 

簡單說明: 404 頁面,也就是一個頁面而已,你只需匹配相對應的 路由就好了。

 

第一步:建立一個 404 頁面

<template>
    <div class="error">
        <span class="aaa">404</span> <br><br><br><br><br><br>
        <span class="bbb">您可以選擇導航欄任意一項回到正確航線 </span>
    </div>
</template>
<script>
export default {
    
}
</script>
<style lang="scss" scoped>
    .error{
        text-align: center;
        margin-top: 25px;
        height: 600px;
        .aaa{
            
            font-size: 250px;
            color: white;
            font-family: '方正舒體'
        }
        .bbb{

            font-size: 80px;
            color: white;
            font-family: '方正舒體'
        }
    }
</style>

 

第二步:在 router 中配置好