iview ui table表格里嵌入其它组件

iview ui table表格里嵌入其他组件的方式

   <Table
        border
        :columns="columnsBox"
        :data="pointList"
        ref="tableA"
        :max-height="170"
      >
        <template
          slot="check"
          slot-scope="{ row, index }"
        >
          <Checkbox
            @on-change="changeStartS(row, index)"
            v-model="selectArray[index]"
          ></Checkbox>
        </template>
        <template
          slot="sw"
          slot-scope="{ index }"
        >
          <div class="swlswrap">
              <!-- 单位更改的 -->
            <Input v-model="pointList[index].yjsw"></Input> <span>m</span>
          </div>
        </template>
        <template
          slot="ls"
          slot-scope="{ index }"
        >
          <div class="swlswrap">
            <Input v-model="pointList[index].ls"></Input> <span>/s</span>
          </div>
        </template>
      </Table>
    <script>
     columnsBox: [
        {
          title: "起点",
          slot: "check",
          align: "center",
          width: 50,
        },
        { title: "站名", key: "dqwz", align: "center", width: 80 },
        { title: "水系", key: "sx", align: "center" },
        { title: "水位", slot: "sw", align: "center" },
        { title: "流量", slot: "ls", align: "center" },
      ],
    </script>
这个是用插槽的方式添加组件
{
	title: '午餐选择',
	key: 'lunch',
	width: 200,
	align: 'center',
	render: (h, params) => {
	    return h('Select', {
			    props:{
					value : this.data[params.index].lunch,  //数据的双向绑定 data是定义好的数据
					transfer: true,
			    },
			    on: {
					'on-change':(event) => { //select改变事件
					    this.data[params.index].lunch = event;
					}
			    },
			},
			this.lunch_array.map(function(val,key){ //lunch_array是午餐的集合数组
			    return h('Option', {
					props:{
					    value:val.value
					}
			    }, val.text);
			})
	    )
	}
},

这个是使用render函数来创建select
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值