当前位置:网站首页>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主要也是为了解决首屏加载慢的问题,那你跳转进来肯定不是首屏了
边栏推荐
- ../ And/
- 2、 Concurrent and test notes youth training camp notes
- Tumor immunotherapy research prosci Lag3 antibody solution
- [ANSYS] learning experience of APDL finite element analysis
- $refs: get the element object or sub component instance in the component:
- Outsourcing for three years, abandoned
- @component(““)
- Tencent's one-day life
- BGP experiment (1)
- Jenkins远程构建项目超时的问题
猜你喜欢
1141_ SiCp learning notes_ Functions abstracted as black boxes
計算機服務中缺失MySQL服務
抽丝剥茧C语言(高阶)指针的进阶
Deep learning Flower Book + machine learning watermelon book electronic version I found
抽丝剥茧C语言(高阶)指针进阶练习
Advanced level of C language (high level) pointer
[ANSYS] learning experience of APDL finite element analysis
外包干了三年,废了...
idea添加类注释模板和方法模板
Bi she - college student part-time platform system based on SSM
随机推荐
mips uclibc 交叉编译ffmpeg,支持 G711A 编解码
按键精灵脚本学习-关于天猫抢红包
Music | cat and mouse -- classic not only plot
Fast quantitative, abbkine protein quantitative kit BCA method is coming!
The currently released SKU (sales specification) information contains words that are suspected to have nothing to do with baby
抽丝剥茧C语言(高阶)指针进阶练习
07_ Handout on the essence and practical skills of text measurement and geometric transformation
Invalid table alias or column reference`xxx`
URP - shaders and materials - simple lit
Chinese and English instructions prosci LAG-3 recombinant protein
Mutual conversion between InputStream, int, shot, long and byte arrays
Advanced practice of C language (high level) pointer
Composition API premise
面试官:你都了解哪些开发模型?
毕设-基于SSM大学生兼职平台系统
Convolutional neural network -- understanding of pooling
95后CV工程师晒出工资单,狠补了这个,真香...
Why is the row of SQL_ The ranking returned by number is 1
Dynamics CRM server deployment - restore database prompt: the database is in use
Several important steps to light up the display