首页 > 其他 > 详细

iview表格render多元素封装

时间:2020-05-26 12:51:22      阅读:83      评论:0      收藏:0      [点我收藏+]
<Table :columns="htitle" :data="data"></Table>
 {
                    title: ‘操作‘,
                    key: ‘operation‘,
                    render: (h, params) => {
                        const btnList = [
                            {
                                text: "编辑",
                                cb: this.handleEdit.bind(vm, params)
                            },
                            {
                                text: "上移",
                                cb: this.handleToTop.bind(vm, params)
                            },
                            {
                                text: "下移",
                                cb: this.handleToBottom.bind(vm, params)
                            },
                            {
                                text: "删除",
                                cb: this.handleDelete.bind(vm, params)
                            }
                        ];

                        const childrens = btnList.map(btn => {
                            return h(
                                "span",
                                {
                                // props: { type: "text", size: "small"},
                                style: {
                                    marginRight: "5px",
                                    color: "#2d8cf0",
                                    cursor:"pointer"
                                },
                                on: { click: btn.cb }
                                },
                                btn.text
                            );
                        });
                        console.log("childrens",childrens);
                        return h("div", childrens);
                    }
                }

效果:

技术分享图片

 

iview表格render多元素封装

原文:https://www.cnblogs.com/ivan5277/p/12964692.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!