iview 表格 指定行高亮并滚动到指定位置

  

 

highlightCurrentRow(index) {
      if (index > -1) {
        this.$refs.table.highlightCurrentRow(index);
        this.$nextTick(() => {
          let tableList = document.querySelectorAll(".table-wrap .ivu-table-body");
          let tableCell = document.querySelector('.table-wrap .ivu-table-tbody .ivu-table-row-highlight');
          for (let item of tableList) {
            try {
              item.scroll(0, tableCell.offsetTop - tableCell.offsetHeight);
            } catch(e) {}
          }
        });
      } else {
        this.$refs.table.clearCurrentRow();
      }
    }

你可能感兴趣的:(view,design,前端,javascript)