zoukankan      html  css  js  c++  java
  • 【转】如何在iview表格中使用select标签

    图例

    粘贴图片

    实现方法

    参数功能

    参数 功能描述
    style 样式
    props 绑定数值以及一些api设置
    on 绑定相关方法,例如点击事件

    api具体值设置以及相关方法请参考 https://www.iviewui.com/components/select#API

    代码块

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    {
              title: "企业名称",
              key: "enterpriseId",
              align: "center",
              render: (h, params) => {
                return h("div", [
                  h(
                    "Select",
                    {
                      style: {
                      },
                      props: {
                        value: this.groupData[params.index].enterpriseId,
                        placement: "top",
                        filterable: true,
                        clearable: true,
                        allowCreate: true
                      },
                      on: {
                        "on-change": event => {
                          this.groupData[params.index].enterpriseId = event;
                          params.row.enterpriseId = event;
                          this.ShowCompanyInfo(params.row, params.index);
                        },
                        "on-create": event => {
                          this.addEnterprise(event);
                        }
                      }
                    },
                    this.enterpriseList.map((item, itemIndex) => {
                      return h(
                        "Option",
                        {
                          props: {
                            value: item.id,
                            key: item.id
                          }
                        },
                        item.name
                      );
                    })
                  )
                ]);
              }
            }
     
    注意

    循环option的时候不要用forEach,forEach在render函数中不起作用,此处应用map。

     
  • 相关阅读:
    kuangbin专题最短路 D
    AC日记——总分 Score Inflation 洛谷 P2722
    AC日记——[USACO09OCT]Bessie的体重问题Bessie's We… 洛谷 P2639
    AC日记——[USACO07DEC]手链Charm Bracelet 洛谷 P2871
    AC日记——[JLOI2014]松鼠的新家 洛谷 P3258
    AC日记——小行星 洛谷 P2711
    AC日记——[USACO09JAN]全流Total Flow 洛谷 P2936
    AC日记——圆桌聚餐 cogs 729
    AC日记——[USACO11DEC]牧草种植Grass Planting 洛谷 P3038
    AC日记——[USACO15DEC]最大流Max Flow 洛谷 P3128
  • 原文地址:https://www.cnblogs.com/cyqdeshenluo/p/12176302.html
Copyright © 2011-2022 走看看