当前位置:网站首页>router---模式
router---模式
2022-08-04 12:59:00 【monstkl】
一、hash模式
默认模式就是hash模式
原理:window.onhashchange事件
并非真实页面地址,而是以参数形式传给单页面文件,只需要保证index.html这个文件路径真实就可以了
二、history模式
new Router({
mode: 'history',
routes: []
})
原理:window.history.pushState完成URL跳转,这种模式需要后端支持,因为如http://xxx/自定义路径在单页面应用中是没有的
后端支持方式一:
服务器需要增加所有情况的候选资源,让它们都返回同一个index.html文件
后端支持方式二:
在服务器上加一个简单的回退路由,如果URL不匹配任何静态资源,就提供index.html文件
边栏推荐
猜你喜欢
持续交付(四)Jenkins多线程任务执行
持续交付(三)Jenkinsfile语法使用介绍
GeoAO:一种快速的环境光遮蔽方案
荧光磷脂PEG衍生物之一磷脂-聚乙二醇-荧光素,Fluorescein-PEG-DSPE
持续交付(二)PipeLine基本使用
Small program on how to play in the construction of e-government service platform value
面试官:如何查看/etc目录下包含abc字符串的文件?
Chinese valentine's day of young people crazy to make money, earn 140000 a week
双目立体视觉学习笔记(一)
MATLAB——图像分块
随机推荐
高手,云集在于REST、gRPC 和 GraphQL之间!
String is a reference type
持续交付(四)Jenkins多线程任务执行
Script to get local IP address
持续交付(二)PipeLine基本使用
leetcode 48. Rotate Image 旋转图像(Medium)
面试官:连 INSERT INTO SET 都不知道怎么用,你这3年都干些什么了?
跨链桥已成行业最大安全隐患 为什么和怎么办
Geoffrey Hinton:深度学习的下一个大事件
【软考 系统架构设计师】软件架构设计② 软件架构风格
Billboard
酷开科技 × StarRocks:统一 OLAP 分析引擎,全面打造数字化的 OTT 模式
《会面》-凯瑟琳曼斯菲尔德(徐志摩译)
【UML】信息系统分析与设计知识点总结
Arduino框架下I2S控制ADC采样以及PWM输出示例解析
MySQL性能指标TPS\QPS\IOPS如何压测?
Two years of independent development experience Programmers tell us the experience of making money (listen to the masters who really make money)
MATLAB——图像分块
"Lonely Walking on the Moon" is a powerful medicine, it can't cure the internal friction of happy twist
Hit the interview!The latest interview booklet of Ali Jin, nine silver and ten is stable!