1、项目结构

2、定义组件

组件1 Login.vue

<template>
<form>
账号:<input type="text">
密码: <input type="text" > </form>
</template> <script>
export default {
name: "login"
}
</script> <style scoped> </style>

组件2 Main.vue

<template>
<h1>这里是主界面</h1>
</template> <script>
export default {
name: "Main"
}
</script> <style scoped> </style>

3、定义路由

import Vue from 'vue'
import Router from 'vue-router'
import Main from '../components/Main'
import Login from '../components/Login'
Vue.use(Router) export default new Router({
routes: [
{
path:'/main',
component:Main
},
{
path:'/login',
component:Login
}
]
})

4、定义首页

<template>
<div id="app">
<router-link to="/login">login</router-link>
<router-link to="/main">main</router-link>
<h1>大家好</h1>
<router-view/>
</div>
</template> <script>
export default {
name: 'App'
}
</script> <style>
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

5、效果展示



最新文章

  1. 2-ser2003系统封装实验报告
  2. Android Studio Gradle 问题 解决方案
  3. 采用CSS3设计的登陆界面
  4. Matlab 2012a 下载和安装教程
  5. find your present
  6. jQuery.fn.extend与jQuery.extend 的区别
  7. Eclipse-----jrebel实现jetty热部署
  8. pie.htc 在IE下不起作用~~~
  9. phpcms的验证码替换 及 phpcms实现全站搜索功能
  10. [学习OpenCV攻略][016][RedHat下安装OpenCV]
  11. js的call和apply区别
  12. ES6 实战项目构建 ES6+glup+express
  13. NumPy学习_01 ndarray相关概念
  14. project 2013 设置工期为1个工作日,但开始时间与结束时间不是同一天
  15. LIght OJ 1179
  16. 分布式监控系统Zabbix-批量添加聚合图形
  17. HDU.5909.Tree Cutting(树形DP FWT/点分治)
  18. kettle学习
  19. Vue -- webpack 项目自动打包压缩成zip文件
  20. android 打开系统相机,

热门文章

  1. 高效能团队的Java研发规范(进阶版)
  2. Taurus.MVC 微服务框架 入门开发教程:项目部署:2、让Kestrel支持绑定多个域名转发,替代Ngnix使用。
  3. CF593D Happy Tree Party(不用树剖)
  4. HDU2065 “红色病毒”问题 (指数型母函数经典板题)
  5. wallpaperPKG文件提取
  6. RestTemplate用法
  7. R数据分析:用R建立预测模型
  8. echarts学习笔记(一)
  9. Linux虚拟机启动报错挂载点丢失
  10. C++基础入门:C++初始