我有一个受 Bootstrap3 启发的建议。如果您查看the code,您会看到一些用于呈现和操作带有btn 和disabled 类的按钮的类:
.btn.disabled,
.btn:disabled,
fieldset[disabled] .btn {
cursor: not-allowed;
opacity: .65;
}
但也可以将btn 和disabled 类应用于锚元素:
a.btn.disaabled,
fieldset[disabled] a.btn {
pointer-events: none;
}
一个锚呈现为
<a class="btn btn-default disabled">I am a button</a>
根据 Safari 提供的这些计算的 CSS 属性:
-webkit-user-select: none;
background-color: rgb(92, 184, 92);
border-bottom-color: rgb(92, 184, 92);
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-style: solid;
border-bottom-width: 1px;
border-left-color: rgb(92, 184, 92);
border-left-style: solid;
border-left-width: 1px;
border-right-color: rgb(92, 184, 92);
border-right-style: solid;
border-right-width: 1px;
border-top-color: rgb(92, 184, 92);
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-top-style: solid;
border-top-width: 1px;
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: not-allowed;
display: inline-block;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 16px;
font-weight: normal;
height: 38px;
line-height: 24px;
opacity: 0.6499999761581421;
padding-bottom: 6px;
padding-left: 16px;
padding-right: 16px;
padding-top: 6px;
text-align: center;
text-decoration: none;
vertical-align: middle;
white-space: nowrap;
width: 111.671875px;
你真正需要的是
-
-webkit-user-select,
-
cursor,这是最相关的,并且
-
opacity,只是为了让它看起来像被禁用。
应用它们,您可以确定您的锚元素的行为完全就像一个按钮。因此,这可能是您的问题的解决方案。
那么,你接下来要做什么?
- 使用
ng-class。必要时添加/删除类disabled。
- 添加一些 CSS 以使您的锚元素表现得像一个按钮。
- 如有必要,将其绑定到
ng-click。
希望对你有帮助。