当前位置:网站首页>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主要也是为了解决首屏加载慢的问题,那你跳转进来肯定不是首屏了
边栏推荐
- Why is the row of SQL_ The ranking returned by number is 1
- 基于Flask搭建个人网站
- 点亮显示屏的几个重要步骤
- Build personal website based on flask
- My ideal software tester development status
- mips uclibc 交叉编译ffmpeg,支持 G711A 编解码
- 电商常规问题part1
- Flexible layout (II)
- Fast quantitative, abbkine protein quantitative kit BCA method is coming!
- Initial experience of teambiion network disk (Alibaba cloud network disk)
猜你喜欢

Sqlmap tutorial (IV) practical skills three: bypass the firewall

Nesting and splitting of components

@component(““)

BGP experiment (1)

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

Cloud backup project

Introduction to abnova's in vitro mRNA transcription workflow and capping method

计算机服务中缺失MySQL服务

抽丝剥茧C语言(高阶)指针的进阶

My ideal software tester development status
随机推荐
Blue Bridge Cup Netizen age (violence)
Build personal website based on flask
How to * * labelimg
修改Jupyter Notebook文件路径
PostgreSQL source code (60) transaction system summary
四、高性能 Go 语言发行版优化与落地实践 青训营笔记
机器人技术创新与实践旧版本大纲
Initial experience of teambiion network disk (Alibaba cloud network disk)
一、Go知识查缺补漏+实战课程笔记 | 青训营笔记
idea添加类注释模板和方法模板
弹性布局(一)
Tencent's one-day life
Asynchronous components and suspend (in real development)
Le Service MySQL manque dans le service informatique
聊聊异步编程的 7 种实现方式
IO流 file
Fullgc problem analysis and solution summary
Outsourcing for three years, abandoned
About some details of final, I have something to say - learn about final CSDN creation clock out from the memory model
Torefs API and toref API