P粉5093831502023-08-30 00:10:45
This can be achieved in two ways.
I have listed method 1 here, suitable for beginners.
This can be achieved through id. I will list a sample html code like jsx
<div> <p id="1">第一行</p> <p id="2">第二行</p> ... ... ... </div>
Assume the page usage is www.samplepage.com
If I make the link concrete i.e. www.samplepage.com#1
It will take me to the first row, just like the anchor tag on the same page
You can store the label in state and use it.
You can also see similar implementations on github.