Is WeChat Mini Programs's request written in onLoad or onReady?

I have heard an elder say that request should be put in onReady and then request after rendering dom. I don"t know what advantage this will bring. Won"t it be slower than putting it in onload? Ask for answers from seniors


is usually placed in onload, and the data is obtained at the beginning of the page loading. If you need to return to this page and load the data, wrap it up and call it in onshow. Here's what I did


I don't think there is a fixed answer to this. It depends on your own needs. OnReady is not much slower than onLoad.

as for your elder's opinion, you'd better ask him.


it is better to put it in onload, where the request and rendering are carried out at the same time.


onShowonLoad
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b374a9-2b8d4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b374a9-2b8d4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?