博客列表 >vue路由组件实现Hash路由案例,Gitee的Git版本控制流程-vue-54课9.10

vue路由组件实现Hash路由案例,Gitee的Git版本控制流程-vue-54课9.10

希望
希望原创
2020年09月13日 22:01:481146浏览

1、vue路由组件实现Hash路由案例

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <script src="../lib/vue.js"></script>
  7. <!-- 路由包 -->
  8. <script src="../lib/vue-router-dev/dist/vue-router.js"></script>
  9. <title>Vue路由的原理</title>
  10. </head>
  11. <body>
  12. <div class="app">
  13. <!-- 1. 使用router-link组件来生成导航<a></a> -->
  14. <router-link to="/news1">科技</router-link>
  15. <router-link to="/news2">教育</router-link>
  16. <router-link to="/news3">美食</router-link>
  17. <!-- 2. 路由内容的渲染 -->
  18. <router-view></router-view>
  19. </div>
  20. <script>
  21. const news1 = {
  22. template: "<p>1. 使用vue路由组件</p>",
  23. };
  24. const news2 = {
  25. template: "<p>2. 基于Hash的路由案例</p>",
  26. };
  27. const news3 = {
  28. template: "<p>3. Gitee的Git版本控制流程</p>",
  29. };
  30. // 注册路由
  31. const router = new VueRouter({
  32. // 配置
  33. routes: [
  34. // 是一个对象数组,每个对象对应一个路由
  35. { path: "/news1", component: news1 },
  36. { path: "/news2", component: news2 },
  37. { path: "/news3", component: news3 },
  38. ],
  39. });
  40. // vue实例
  41. const vm = new Vue({
  42. // 将路由注册到挂载点中
  43. // 当属性名与变量同名,只需要写一个
  44. router,
  45. }).$mount(".app");
  46. </script>
  47. </body>
  48. </html>

2、Gitee的Git版本控制流程


  1. 工作区:
  2. 1、创建文件夹git-edu
  3. 2、在它下面再创建两个文件:demo1.htmlindex.php
  4. # 切换到需要使用git进行版本控制的项目目录中
  5. cd git-edu
  6. # 配置用户名和邮箱
  7. git config --global user.name melinda
  8. git config user.name
  9. git config --global user.email '123456@qq.com'
  10. git config user.email
  11. 或者git config --list也能检查
  12. clear清除
  13. # git 版本库的初始化: 创建本地版本库
  14. git init
  15. # 创建版本库的忽略文件 .gitignore
  16. .git/
  17. # 将工作区的已经修改过的文件, 提交到本地版本库中的暂存区
  18. git add . # 一次性全部提交完毕
  19. git status # 查看状态
  20. # 再将所有的内容从本地暂存区一次性的提交到本地的版本库
  21. git commit -m '2020-9-13 21:06'
  22. # 添加远程版本库
  23. 在这个网站https://gitee.com注册并新建仓库
  24. https://gitee.com/melinda2020/git-edu
  25. 找到克隆下载,复制:https://gitee.com/melinda2020/git-edu.git
  26. 复制下面的代码在下面的终端生成
  27. git remote add origin https://gitee.com/melinda2020/git-edu.git
  28. git remote add origin https://gitee.com/用户个性地址/HelloGitee.git
  29. # 查看远程仓库
  30. git remote -v
  31. 得到以下两个地址
  32. origin https://gitee.com/melinda2020/git-edu.git (fetch)
  33. origin https://gitee.com/melinda2020/git-edu.git (push)
  34. 提交到本地
  35. git commit -m 'melinda'
  36. # 提交到远程仓库
  37. git push origin master
  38. git push -u origin master
  39. git push -f origin master
  40. # 从远程仓库拉取内容
  41. git pull https://gitee.com/melinda2020/git-edu.git
  42. git pull origin master
  • 总结:
  • vue路由原理:根据路由/锚点的不同, 显示不同的内容
声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议