Normal requirements: Either the above URL will not change when you click the tab; or this is the effect you have now.
If you have to do it according to your current weird needs: First determine whether your needs require removing the hash of the URL. If you do, remove the hash before dom rendering. If you don't remove it before, there will be problems. Jitter. If you don’t remove it, add class clicked when the tab is clicked, and write the selector as .clicked:target. This will ensure that the page will not be selected by .clicked:target when you refresh it.
Normal requirements: Either the above URL will not change when you click the tab; or this is the effect you have now.
If you have to do it according to your current weird needs:
First determine whether your needs require removing the hash of the URL. If you do, remove the hash before dom rendering. If you don't remove it before, there will be problems. Jitter.
If you don’t remove it, add class
clicked
when the tab is clicked, and write the selector as.clicked:target
. This will ensure that the page will not be selected by.clicked:target
when you refresh it.Use js to make judgments in the page loading event
If there is an anchor after the current url, redirect to index.html
Executed before routing