vue的路由的简介

一、要区分后端路由与前端路由

  后端路由:应用程序如何去处理不同的url地址发送过来的请求。
    POST localhost:3000/api/login
    GET  localhost:3000/list 

  前端路由:不同的url地址要渲染不同的页面效果出来
    1.1 GET localhost:8080/index.html 
    1.2 GET localhost:8080/list.html 
    1.3 GET localhost:8080/about.html 

    2.1 GET localhost:8080/index
    2.2 GET localhost:8080/list
    2.3 GET localhost:8080/about

    3.1 GET localhost:8080/#/index
    3.2 GET localhost:8080/#/list
    3.3 GET localhost:8080/#/about

    1.x 的是以往看到的最多的
    2.x 与 1.x 的很类似,     history 模式路由
    3.x 修改hash的操作        hash 模式路由
    

  后端路由与前端路由最本质的一个区别:
    前端路由只处理 GET 请求


  二、单页面应用 SPA  single page application
      一个应用只有一个html页面,它就是 SPA.
      页面的切换其实是组件的切换,并修改了url地址。

      
      类似刚才的动态组件的切换加上url地址的控制操作



  三、多页面应用 MPA  multe page application
      一个应用是有多个html页面组成的,页面之间的跳转是通过a标签的方式跳转的
发布了4 篇原创文章 · 获赞 57 · 访问量 355

猜你喜欢

转载自blog.csdn.net/weixin_45816830/article/details/105523938