小编Pan*_*nda的帖子

如何修复 nz-table 删除角度中无数据显示的问题

这是代码:

<nz-table #listTable nzSize="middle" [nzData]="data">
      <thead>
        <tr>
          <th nzShowExpand></th>
          <th>Location</th>
          <th>Device</th>
          <th class="tbWidth text-center">Actions</th>
        </tr>
      </thead>
      <tbody>
        <ng-template ngFor let-data [ngForOf]="listTable.data">
          <tr>
            <td nzShowExpand [(nzExpand)]="mapOfExpandData[data.id]"></td>
            <td nzBreakWord [textContent]="data.name"></td>
            <td nzBreakWord [textContent]="data.device"></td>
            <td nzBreakWord class="text-center">
              <nz-button-group>
                <button nz-button nzType="primary" (click)="openFormDrawer(data)"><i nz-icon nzType="edit"
                    nzTheme="outline"></i></button>
                <button nz-button nzType="danger" (click)="deleteRoomData(data)"><i nz-icon nzType="delete"
                    nzTheme="outline"></i></button>
              </nz-button-group>
            </td>
          </tr>
          <tr [nzExpand]="mapOfExpandData[data.id]">
            <td></td>
            <td colspan=7>
              <nz-table>
                <thead>
                  <tr>
                    <th nzWidth="25%">Location Code</th>
                    <th nzWidth="25%">Location Description</th>
                    <th nzWidth="25%">Device Code</th>
                    <th nzWidth="25%">Device Description</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td nzBreakWord [textContent]="data.locationCode"></td>
                    <td …
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular

5
推荐指数
2
解决办法
6068
查看次数

如何使其在角度上每 5 分钟触发/警报一次

  limitExceed(params: any) {
    params.forEach((data: any) => {
      if (data.humidity === 100) {
        this.createNotification('warning', data.sensor, false);
      } else if (data.humidity >= 67 && data.humidity <= 99.99) {
        this.createNotification('warning', data.sensor, true);
      }
    });
  }

  createNotification(type: string, title: string, types: boolean): void {
    this.notification.config({
      nzPlacement: 'bottomRight',
      nzDuration: 5000,
    });
    if (types) {
      this.notification.create(
        type,
        title,
        'Humidity reached the minimum limit'
      );
    } else {
      this.notification.create(
        type,
        title,
        'Humidity reached the maximum'
      );
    }
  }
Run Code Online (Sandbox Code Playgroud)

如何让它每 5 分钟触发/警报一次。但首先它会发出警报,然后在第一次警报/触发之后,它会每 5 分钟再次发出警报/触发。

因为我已经这样设置了setInterval

setInterval(() …
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular

4
推荐指数
1
解决办法
1568
查看次数

如何使用 css 和 javascript 创建泪滴/水滴填充

如何使用 css 和 javascript 动态填充水来创建泪滴/水滴填充。

例如。

在此输入图像描述

它将填充水/泪滴,具体取决于百分比。

例如,当百分比为 100% 时,它将充满水/泪滴。

javascript css

1
推荐指数
1
解决办法
2066
查看次数

如何检查数组数据是否已经以角度存在

这是代码:

data = [
    {
        'id': 'asdja',
        'username': 'james',
    },
    {
        'id': 'asqweja',
        'username': 'rhou',
    },
    {
        'id': 'asdqweqj',
        'username': 'arianne'
    },
    {
        'id': 'qpoaksl',
        'username': 'ryan'
    }
];
Run Code Online (Sandbox Code Playgroud)

我正在尝试检查是否username已经存在。

例如,如果我输入,"james"那么它应该显示"Username already exists"

我尝试使用查找:

if (username === data.find((x: any) => x.username === x.username) {
 console.log('Username already exists');
} else {
 console.log('');
}
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular

1
推荐指数
1
解决办法
2484
查看次数

标签 统计

javascript ×4

angular ×3

typescript ×3

css ×1