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。

     
  • 相关阅读:
    夜半饮酒
    邀你到成都来
    成都,我的天堂
    真不想松开你的手
    创业,你懂如何求人办事么?
    只要你愿意
    【五月的歌】重振山河
    成都,我爱你
    就算忘了自己也忘不了你
    假如
  • 原文地址:https://www.cnblogs.com/cyqdeshenluo/p/12176302.html
Copyright © 2011-2022 走看看