🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
运行效果: ![](https://img.kancloud.cn/a6/06/a60683ff58a83b648b265419f22add1c_1107x791.png) 第一步:安装Vue Router依赖包 ~~~ vue add router ~~~ 如图所示: ![](https://img.kancloud.cn/20/b6/20b6113439f903a4d5863e8889385d70_989x698.png) 第二步:完善404路由 1. 在`src/router/index.js` `const routes` 尾部新增 ``` { path: '*', name: '404', component: NotFound } ``` 2. 在`src/router/index.js` 导入 `NotFound`组件 ``` import NotFound from '../views/NotFound.vue' ``` 3. 创建`NotFound.vue`文件,并赋值如下内容 ``` <template><div><h1>404</h1></div></template> ``` 温馨提示:安装完毕后,并按以上步骤完善后,可以在浏览器中查看运行效果.