简体   繁体   中英

Encode URL in page.js

Is there a way to encode a URL by default while using page.js

For example:

<a href="/some link">Click</a

This gives http://example.com/some link in the address bar instead of http://example.com/some%20link .

To achieve this you need to do

<a href={encodeURI('/some link')}>click</a>

Is there any other work around?

I think you will need to mention the url in this form:

<a href="some_link">Click</a>

Which will mean http://example.com/some_link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM