~/ equivalent in javascript

后端 未结 12 1989
萌比男神i
萌比男神i 2020-12-12 19:11

Any smart way of doing a \"root\" based path referencing in JavaScript, just the way we have ~/ in ASP.NET?

12条回答
  •  长情又很酷
    2020-12-12 19:53

    Another option that's a bit simpler and more universal would be to take the following:

    
    

    then regardless of what subdirectory the urls will always be rendered correctly.

提交回复
热议问题