iview render实现table一行一个单元格同时展示字段和按钮

//效果图是这样的

// 代码render方法如下

<template>
    <table border :columns="columns" :data="data"></table>
</template>
<script>
    export default {
        data () {
            return {
                columns: [
                      {title: '年龄',key: 'age'},
	                  {title: '地址', key: 'address'},
	                  {title: '操作',key: 'action'}
	                  {title: '户口',
	                   width: 200,
	                   align: 'center',
	                   render: (h, row) => {
		                   return h('div',[
		                    // consolg.log(row) 拿到row你要展示在按钮上面的字段
		                     h('div', row.row.address),
		                     h('Button', {
		                     props: {type: 'primary'},
		                     style: {marginRight: '3px'},
		                     on: {
		                       click: (e) => {
		                          console.log('点击按钮事件')
		                         }
		                       }
		                     }, '账单信息'),
		                     h('Button', {
		                     props: {type: 'primary'},
		                     on: {
		                       click: (e) => {
		                          console.log('点击按钮事件')
		                         }
		                       }
		                     }, '缴款信息'),
		                   ])
	                   }
	                  }
                    ],
                data: [
                   {name: '围护', age: 18, address: '深圳福田'},
                   {name: '估计',age: 25,address: '湖北崇阳'}
                ]
            }
        },
        methods: {
        }
    }
</script>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值