Js determines whether pc or mobile load the corresponding code.

the vue project determines the route directly to the mobile terminal if the mobile terminal is redirected to the mobile terminal in router.beforeeach. Else is pc, so load the root route.
the problem now is that when the mobile terminal accesses, it will flash the home page of the pc first and then jump to the route of the mobile terminal. How to solve this. The desired result of
is that pc loads the pc home page directly. Move to load the mobile home page directly. The pc homepage will not flash first on the jump transfer mobile

Sep.03,2021

the front end loads js only after the html is loaded. At this time, the html is already loaded and then the jump will naturally flash. Let the backend do it or ng configure


it is recommended to do proxy distribution in the nginx/apache layer to determine the source of the device and distribute it to different pages for landing. Using beforeEach, as you said, cannot solve the problem of flash, which brings about problems in experience.

nginx configuration reference https://blog.csdn.net/u012562.


No. This depends on where the code written by your router.beforeeach is written in the program. The project I have done is also judged by router.beforeeach. If you write it before the new Vue loads the instance, the page will not go in at all, nor can you see the source code inside. Take a closer look at my https://github.com/markbzhang.

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-1b38668-2c119.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-1b38668-2c119.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?