Vue项目新建一个路由页面
2019-05-29 本文已影响239人
祈澈菇凉
我们现在要新建一个测试页面,命名为Test.vue
1:在components底下新建Test.vue
![](https://img.haomeiwen.com/i5640239/7671c587539fe8c6.png)
<template>
<div>我是测试界面</div>
</template>
<script>
</script>
<style>
</style>
2:打开App.vue
{name:'/components/Test',navItem:'测试界面'},
![](https://img.haomeiwen.com/i5640239/e6c4ad21da9fa1d0.png)
3:打开路由来,导入组件
index.js
import Test from '@/components/Test'
{
path: '/components/Test',
name: 'Test',
component: Test
}
![](https://img.haomeiwen.com/i5640239/8ca49f5505e1e1fe.png)
![](https://img.haomeiwen.com/i5640239/8ac08b53c01d4eaa.png)
4:查看效果
![](https://img.haomeiwen.com/i5640239/9d73a10c5efd8e8c.png)
好啦,新的路由页面已经建立了。
原文作者:祈澈姑娘 技术博客:https://www.jianshu.com/u/05f416aefbe1
90后前端妹子,爱编程,爱运营,文艺与代码齐飞,魅力与智慧共存的程序媛一枚,对于博客上面有不会的问题,欢迎加入编程微刊qq群:260352626。