7

css实现a标签置灰不可点击

 2 years ago
source link: https://chegva.com/5377.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

css实现a标签置灰不可点击

由于a标签没有disable属性,如果想用disable禁止a标签的点击事件,也是可以通过css来实现的。

首先创建一个class命名disable,然后将disable加到a标签上。chrome和firefox上亲测好使。

.disable {
  color: #c4c6cc;
  pointer-events: none;
  user-select: none;
}

<a style="margin-right: 6px" class="disable" @click="addTaskAssign(record)">
  <a-icon type="edit" />编辑
</a>

查看效果,这样就可以根据状态,动态添加disable让a标签实现不可点击了。

css实现a标签置灰不可点击

参考:如何禁用 a 标签的点击事件 disabled属性 和 pointer-events属性值详解

安志合个人博客,版权所有 丨 如未注明,均为原创 丨 转载请注明转自:https://chegva.com/5377.html | ☆★★每天进步一点点,加油!★★☆ | 

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK