当前位置:网站首页>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主要也是为了解决首屏加载慢的问题,那你跳转进来肯定不是首屏了
边栏推荐
- How to reduce inventory with high concurrency on the Internet
- Nesting and splitting of components
- Jenkins远程构建项目超时的问题
- Composition API premise
- 1、 Go knowledge check and remedy + practical course notes youth training camp notes
- Causes and solutions of oom (memory overflow)
- Blue Bridge Cup Birthday candles (violence)
- 【云原生】内存数据库如何发挥内存优势
- C language (high-level) data storage + Practice
- Kuboard can't send email and nail alarm problem is solved
猜你喜欢

Composition API premise

BGP experiment (1)

1089: highest order of factorial

The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?

Nesting and splitting of components

聊聊异步编程的 7 种实现方式

MySQL service is missing from computer service

抽丝剥茧C语言(高阶)数据的储存+练习

Make a bat file for cleaning system garbage

Interviewer: what development models do you know?
随机推荐
科技云报道:从Robot到Cobot,人机共融正在开创一个时代
[ANSYS] learning experience of APDL finite element analysis
What is the difference between TCP and UDP?
身边35岁程序员如何建立起技术护城河?
Readonly read only
Lm11 reconstruction of K-line and construction of timing trading strategy
毕设-基于SSM大学生兼职平台系统
Build personal website based on flask
JSON introduction and JS parsing JSON
MySQL service is missing from computer service
idea添加类注释模板和方法模板
Asynchronous components and suspend (in real development)
[cloud native] how to give full play to memory advantage of memory database
抽丝剥茧C语言(高阶)指针进阶练习
Implementing data dictionary with JSP custom tag
Leetcode-206. Reverse Linked List
【leetcode】1020. Number of enclaves
普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
Introduction to abnova's in vitro mRNA transcription workflow and capping method
MobaXterm