当使用行数不均匀的行跨时如何删除表中的空白空间?

问题描述

我试图创建一个表,其中第一行作为父行,rowspan,下面的另一行作为子行。我提供了以下示例,有人可以告诉我如何摆脱第一行中的空白空间吗?如果rowpan内的任何文本较大并且获取多于1行,则会出现空白区域。我试图在第一行中包含第4个td标签,并显示:无,但仍然无法正常工作。

pop

解决方法

检查是否适合您!

import { LitElement,html,css,customElement } from 'lit-element';

@customElement('my-section')
export class Section extends LitElement {
  static get styles() {
    return css`
      * {
        margin: 20px;
      }
    `;
  }

  render() {
    return html`
      <h1>My section</h1>
      <my-block
        style="border: 1px solid tomato;"
        @keyup="${(e: KeyboardEvent) => {
          let el = <HTMLElement>e.target;
          console.log(el.offsetHeight);
        }}"
      ></my-block>
    `;
  }
}

@customElement('my-block')
export class Block extends LitElement {
  render() {
    return html`
      <h2>Block</h2>
      <div contenteditable="true" style="border:1px solid steelblue">
        Lorem ipsum
      </div>
    `;
  }
}

enter image description here上尝试一下