设置按钮显示在悬停上 [英] set button to appear on hover

查看:98
本文介绍了设置按钮显示在悬停上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在棱角4材质的表格单元格中有一个按钮,仅当将鼠标悬停在表格行上时才会显示:

I have a button in angular 4 material table cell that I'd like to appear only when hover on table row:

<md-cell *cdkCellDef="let row" contenteditable='false' > 
        <div *ngIf="!row.editorEnabled" >{{row.goalStatusName}}
            <button md-icon-button><md-icon (click)="row.editorEnabled=true;" mdTooltip="Edit">mode_edit</md-icon></button>
          </div>
</md-cell>

我该如何实现?

更新: 完整代码:

<md-cell *cdkCellDef="let row" contenteditable='false' > 
        <div *ngIf="!row.editorEnabled" >{{row.goalStatusName}}
            <button md-icon-button><md-icon (click)="row.editorEnabled=true;" class="editButton" mdTooltip="Edit">mode_edit</md-icon></button>
          </div>
        <div *ngIf="row.editorEnabled" >
          <md-input-container><input mdInput [(ngModel)]="row.goalStatusName" #goalName></md-input-container>
            <button md-icon-button>
              <md-icon (click)="modifyGoal(row.goalStatusId,row.goalStatusName)" mdTooltip="Save" style="color:green;font:bold;" >done</md-icon>
            </button>
            <button md-icon-button>
              <md-icon (click)="row.editorEnabled=false" mdTooltip="Cancel" style="color:red;font:bold;" >clear</md-icon>
            </button>
          </div>
    </md-cell>

推荐答案

button{ display:none}
md-cell:hover{

  button{
     display:block
  }
}

这篇关于设置按钮显示在悬停上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆