当前位置:网站首页>vus.SSR在asynData函数中请求数据的注意事项
vus.SSR在asynData函数中请求数据的注意事项
2022-07-07 04:04:00 【Attacking-Coder】
摘要
在服务器渲染时如果需要请求数据时不能在mouted生命周期中请求,这是因为mouted是等组件实例全部挂在到页面上时才会发请求,这样请求其实是在客户端完成的不利于SEO。而我们在做SSR时的初衷其实除了为加快首屏加载,还有一个就是为了SEO(被爬虫爬),
所以我们要在asynData声明周期中执行
注意点
- 如果是页面刷新时asynData的请求是在服务端完成的
- 如果页面是由其他页面跳转进来的那么asynData的请求是在 客户端完成的
解释:为什么由其他页面进入时请求是在客户端完成的?
这是因为爬虫爬的时候不会从某个页面点击进入该页面的,只会是直接进入指定的URL所以这样不会影响SEO
其次呢SSR主要也是为了解决首屏加载慢的问题,那你跳转进来肯定不是首屏了
边栏推荐
- 【性能压测】如何做好性能压测?
- BGP experiment (1)
- My ideal software tester development status
- 4、 High performance go language release optimization and landing practice youth training camp notes
- Differences between H5 architecture and native architecture
- Leetcode sword finger offer brush questions - day 20
- Composition API premise
- Nesting and splitting of components
- 抽丝剥茧C语言(高阶)指针的进阶
- Outsourcing for three years, abandoned
猜你喜欢

mips uclibc 交叉编译ffmpeg,支持 G711A 编解码

三、高质量编程与性能调优实战 青训营笔记

MobaXterm

Make a bat file for cleaning system garbage

At the age of 20, I got the ByteDance offer on four sides, and I still can't believe it

Communication between non parent and child components

普通测试年薪15w,测试开发年薪30w+,二者差距在哪?

Outsourcing for four years, abandoned

计算机服务中缺失MySQL服务

Redis data migration
随机推荐
Asynchronous components and suspend (in real development)
Mobx knowledge point collection case (quick start)
修改Jupyter Notebook文件路径
弹性布局(一)
Lm11 reconstruction of K-line and construction of timing trading strategy
[semantic segmentation] - multi-scale attention
Abnova immunohistochemical service solution
考研失败,卷不进大厂,感觉没戏了
Deep learning Flower Book + machine learning watermelon book electronic version I found
Le Service MySQL manque dans le service informatique
Causes and solutions of oom (memory overflow)
Wechat applet full stack development practice Chapter 3 Introduction and use of APIs commonly used in wechat applet development -- 3.9 introduction to network interface (IX) extending the request3 met
深度学习花书+机器学习西瓜书电子版我找到了
[2022 CISCN]初赛 web题目复现
Advanced level of C language (high level) pointer
Kuboard无法发送邮件和钉钉告警问题解决
Procedure in PostgreSQL supports transaction syntax (instance & Analysis)
外包幹了三年,廢了...
C language (high-level) data storage + Practice
Invalid table alias or column reference`xxx`