Problem description

Tags are used on the page (single page application), and the address of the mailbox is set in the href attribute, for example:

<a href="mailto:[email protected]">[email protected]</a>
Copy the code

When you click [email protected] on the page, the last level of directory in the address bar of the page will be displayed as falthPath. The corresponding error on the page is an error configured in the route when the current path cannot be found, usually a 404 page.

Analysis of the

The web application uses the href value as the name of the route when clicking on the mailbox. So, when the href value is used as the last directory in the address bar, the current URL is a non-existent address, and therefore displays the above 404 page or other configured error page when the current path cannot be found.

To solve

In the href of the tag, instead of using the address to jump to, use a JavaScript expression that can be used to prevent some link or button from executing the binding’s default behavior. “, and then add a native click event to the tag to perform the jump action. That is:

<a href="javascript:void(0);" onclick="javascript:window.location.href='mailto:[email protected]'; return false;">[email protected]</a> 
Copy the code

In this way, the local mail client can be invoked by clicking on the email address on the page in the single-page code.

reference

Hk.uwenku.com/question/p-… M.yisu.com/zixun/10641…