使用Iview里面的Table我加了一个超出固定左列,同时那一列有个children属性他就没有生效?

新手上路,请多包涵

具体问题是他渲染时自动隐藏了父级,只显示子级。超出也可以滑动但是左侧没有固定,我不知道是Iview本身的bug还是我用法有问题。原文表头是动态反的我简单写了个例子

<Table :columns="columns" :data="data" border ></Table>
//表头
  columns: [
        {
          fixed: 'left',
          title: "疾病类型",
          key: "疾病类型",
          align: 'center',
          children: [
            {
              minWidth: 120,
              align: 'center',
              title: "分人群分类",
              key: "疾病类型-分人群分类"
            },
            {
              minWidth: 120,
              align: 'center',
              title: "其他分类",
              key: "疾病类型-其他分类"
            },
          ],

        },
        {
          title: "合计",
          key: "合计",
          align: 'center',
          minWidth: 120,
          children: [
            {
              minWidth: 120,
              align: 'center',
              title: "发病数",
              key: "合计-发病数"
            },
            {
              minWidth: 120,
              align: 'center',
              title: "死亡数",
              key: "合计-死亡数",
            },
          ],

        },
        {
          title: "肺结核",
          key: "肺结核",
          align: 'center',
          minWidth: 120,
          children: [
            {
              minWidth: 120,
              align: 'center',
              title: "发病数",
              key: "肺结核-发病数"
            },
            {
              minWidth: 120,
              align: 'center',
              title: "死亡数",
              key: "肺结核-死亡数",
            },
          ],

        },
        {
          title: "利福平耐药",
          key: "利福平耐药",
          align: 'center',
          minWidth: 120,
          children: [
            {
              minWidth: 120,
              align: 'center',
              title: "发病数",
              key: "利福平耐药-发病数"
            },
            {
              minWidth: 120,
              align: 'center',
              title: "死亡数",
              key: "利福平耐药-死亡数",
            },
          ],

        },
        {
          title: "病原学阳性",
          key: "病原学阳性",
          align: 'center',
          minWidth: 120,
          children: [
            {
              minWidth: 120,
              align: 'center',
              title: "发病数",
              key: "病原学阳性-发病数"
            },
            {
              minWidth: 120,
              align: 'center',
              title: "死亡数",
              key: "病原学阳性-死亡数",
            },
          ],

        },
        {
          title: "病原学阴性",
          key: "病原学阴性",
          align: 'center',
          minWidth: 120,
          children: [
            {
              minWidth: 120,
              align: 'center',
              title: "发病数",
              key: "病原学阴性-发病数"
            },
            {
              minWidth: 120,
              align: 'center',
              title: "死亡数",
              key: "病原学阴性-死亡数",
            },
          ],

        },
        {
          title: "无病原学结果",
          key: "无病原学结果",
          align: 'center',
          minWidth: 120,
          children: [
            {
              minWidth: 120,
              align: 'center',
              title: "发病数",
              key: "无病原学结果-发病数"
            },
            {
              minWidth: 120,
              align: 'center',
              title: "死亡数",
              key: "无病原学结果-死亡数",
            },
          ],

        },
      ],

效果图:

阅读 1.6k
1 个回答
新手上路,请多包涵

问题解决了,在children里面也要同步加上fixed,就可以了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题