a标签禁用

 <a [disabled]="true">链接</a>

以上写法不能实现a标签禁用功能

Can't bind to 'disabled' since it isn't a known property of 'a'.

正确写法:

<a href="javascript:void(0)" [ngClass]="{
     
     'disabled': isDisabled}">链接</a>

href一定要加,不加实现不了置灰

在这里插入图片描述

a.disabled {
    
    
  color: gray;
  cursor: not-allowed;
  pointer-events: none;
  text-decoration: none;
}

猜你喜欢

转载自blog.csdn.net/weixin_45678402/article/details/130420018