在鼠标悬停时突出显示角度表单元格内容,然后单击

时间:2019-01-25 00:12:10

标签: html css angular

我试图弄清楚当我将鼠标悬停和/或单击时如何突出显示角度表单元格的文本/内容

我在这里浏览了有关角度的文档-https://angular.io/guide/attribute-directives。但这似乎很麻烦。有任何优化或简便的方法可以实现这一目标吗?

import calendar

def add_24th_hour(row):
    date = row['datetime']
    if date.hour == 00:
        hour = 24
        day = date.day -1
        return "{:02d}{}{:02d}:{:02d}:{:02d}:{:02d}".format(day, 
                                                            calendar.month_abbr[date.month], 
                                                            date.year, 
                                                            hour, 
                                                            date.minute, 
                                                            date.second)
    else:
        return "{:02d}{}{:02d}:{:02d}:{:02d}:{:02d}".format(date.day, 
                                                            calendar.month_abbr[date.month], 
                                                            date.year, 
                                                            date.hour, 
                                                            date.minute, 
                                                            date.second)

df['datetime'] = pd.to_datetime(df['datetime'], format = '%d%b%y:%H:%M:%S')
df.loc[:,'24hr_datetime'] = df.apply(add_24th_hour, axis=1)

1 个答案:

答案 0 :(得分:0)

我宁愿在Angular中将CSS类用于此类功能,如果您必须对许多组件使用相同的功能,则会创建指令。

handleClickEvent() {
  // perform click operation
}
.custom-venue td:hover {
  cursor: pointer;
  background: yellowgreen;
  font-weight: bold;
}

.custom-venue td:focus {
  outline: none;
  background: yellowgreen;
  font-weight: bold;
}
<tbody>
    <tr class="custom-venue" *ngFor="let venue of venues[0]">
        <td (click)="handleClickEvent()">Handle Click</td>
        <td>{{venue.address}}</td>
        <td>{{venue.description}}</td>
        <td>{{venue.isactive}}</td>
        <td>{{venue.userid}}</td>
        <td>{{venue.displayid}}</td>
    </tr>
</tbody>