I have two small issues .
I have a <a>
Tag wrapper href to /detail
. In this tag, I have another <a>
tag to href to /user
. Do I need set attribute or something for href to /user
?
With button in <a>
tag href to /detail
, how can I fire an event without href continue?
My Code:
<a href="/detail">
<a href="/user">Route to User</a> <!-- Is this right? -->
<button @click="reportUser()">Report this user</button> <!-- How can I fire event report without href to /detail -->
</a>
中使用href导航到特定URL
答案 0 :(得分:3)
.topMostAnchor {
background-color: red;
height: 200px;
width: 200px;
display:inline-block;
position:relative;
}
.innerAnchor {
background-color: yellow;
position: absolute;
top: 20px;
z-index: 9;
left: 10%;
}
button {
background-color: green;
position: absolute;
bottom: 20px;
z-index: 9;
left: 10%;
}
<a href="/detail" class="topMostAnchor">
<a href="/user" class="innerAnchor">Route to User</a> <!-- Is this right? -->
<button @click="reportUser()">Report this user</button> <!-- How can I fire event report without href to /detail -->
</a>
这是一个非常糟糕的结构,但是如果您想要拥有或无法更改它,那么您可以通过位置和z-index实现所需的功能。这是唯一的方法,因此您只能单击一个按钮,而href不会生效或不会被单击。 享受