Skip to content

🐛 [Bug]: 高级列表调整列宽,不会根据鼠标拖动调节想要的列宽 #324

@wujisui

Description

@wujisui

Version

15.1.2

Angular Version

15.1.2

Link to minimal reproduction

onResize({ width }: { width: string }, field: string) {
    const index = this.tableWidthConfig.findIndex((config) => {
      return config.field === field;
    });
    if (index > -1) {
      this.tableWidthConfig[index].width = width + 'px';
    }
  }

Step to reproduce

直接在 https://devui.design/admin/pages/list/advance 地址打开调节列宽就可以复现

What is expected

调整列宽的时候,调整的列宽能根据鼠标停留位置停下。

What is actually happening

无法精确调整列宽到想要的宽度。

Any additional comments (optional)

官网有个例子,能完美解决到问题

import {
  ChangeDetectorRef,
  Component,
  ElementRef,
  OnInit,
} from '@angular/core';

import { tableResizeFunc} from "ng-devui";

export class AdvanceListComponent implements OnInit {

  tableWidthConfig: TableWidthConfig[] = [
    {
      field: 'checkbox',
      width: '30px',
    },
    {
      field: 'id',
      width: '150px',
    },
    {
      field: 'title',
      width: '200px',
    },
  ];
 constructor(
    private ref: ChangeDetectorRef,
    private ele: ElementRef
  ) {
  }

onResize = tableResizeFunc(this.tableWidthConfig, this.ele);

}

但是又一个问题是,当我把 d-data-table 封装成组件的时候,tableWidthConfig 通过父组件传递过来的就无法调整列宽。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions