我有以下代码可以在新标签页中打开链接。该代码可以在Chrome浏览器上正常运行,但不能在Firefox中运行。在google中搜索后,我发现定位标记不应该直接包含在button中,因此我放置了一个div标记来封闭定位标记,但仍然无效。
<button type="button" (click)="getDirection(m.geometry.location.lat,m.geometry.location.lng)" class="waves-effect waves-light btn directions">
<div>
<a href="https://www.google.com/maps/dir/?api=1&origin={{srcOriginLat}},{{srcOriginLng}}&destination={{srcDestinationLat}},{{srcDestinationLng}}&travelmode=driving" target='_blank'>{{'directions' | translate}} </a>
</div>
</button>
答案 0 :(得分:0)
我删除了按钮标签,并直接将href插入div中,它工作正常。
<div (click)="getDirection(m.geometry.location.lat,m.geometry.location.lng)" class="waves-effect waves-light btn directions">
<a href="https://www.google.com/maps/dir/?api=1&origin={{srcOriginLat}},{{srcOriginLng}}&destination={{srcDestinationLat}},{{srcDestinationLng}}&travelmode=driving"
target='_blank'>{{'directions' | translate}} </a>
</div>