css - <a> 레이블 클릭을 비활성화하는 방법, <a> 레이블이 비활성화된 효과를 실현하도록 함(마우스가 클릭 이벤트를 트리거할 수 없음)

소개하다

a 태그에는 disabled 속성이 없다는 것을 알고 있습니다. 그렇다면 태그 버튼을 비활성화하려면 어떻게 해야 할까요?

방법 1(권장)

다음 코드와 같이 "disabled" 속성을 a 태그로 설정합니다.

<a style="pointer-events:none" @click="xx()">

이렇게 하면 @click클릭 이벤트가 발생하지 않습니다.

방법 2

jquery: removeAttr() 또는 JS: removeAttribute()를 사용하여 a 태그의 href 속성을 제거합니다.

방법 3

jquery: unbind() 또는 JS: removeEventListener()를 사용하여 클릭 이벤트를 제거합니다.

다른

a 태그를 비활성화하려면 다음과 같이 클래스에서 disabled를 호출할 수 있습니다.

<style>
   a.disabled {
      
      
        style="color:rgb(98 189 255)">pointer-events: none;
        style="color:rgb(255 211 0)">filter: alpha(style="color:rgb(253 97 106)">opacity=50); /*IE滤镜,透明度50%*/
        style="color:rgb(98 189 255)">-moz-style="color:rgb(253 97 106)">opacity: 0.5; /*Firefox私有,透明度50%*/
        style="color:rgb(253 97 106)">opacity: 0.5; /*其他,透明度50%*/
    }
</style>

추천

출처blog.csdn.net/weixin_50545213/article/details/128903708