iview中table里嵌套i-switch、input、select等

iview中table内嵌套

input

 render:(h,params) => {
               return h('Input',{
                     props: {
                           value:'',
                           size:'small',
                          },
                        on: {
                               input: (val) => {
                    t.data[params.index].estimateTime = val
                            }
                        },
                     })
                   }
View Code

select

 render: (h, params) => {
                             return h('Select',{
                                    props:{
                                    },
                                    on: {
                                       'on-change':(event) => {
                                            this.data[params.index].volumeType = event;
                                        }
                                     },
                                },
                                params.row.action.map((item) =>{
                                    return h('Option', {
                                         props: {
                                             value: item.value,
                                            label: item.name
                                        }
                                     })
                                 })
                            )
                      }
View Code

i-switch

render: (h, params) => {
                            //return h('元素',{元素的性质},'内容')
                            return h('i-switch', {
                                    props: {
                                        size: "large",
                                        value: params.row.status == "true"
                                    },
                                    on: {
                                        'on-change': (value) => {
                                            params.row.status = value;
                                            const th = this;
                                            axios.get(th.url + '/departmentType/updateStatus', {
                                                params: {
                                                    dId: params.row.dId,
                                                    status: value
                                                }
                                            }).then(function(res) {
                                                if (res.data.code === 1028) {
                                                    th.$Message.success(res.data.message);
                                                } else {
                                                    th.$Message.error(res.data.message);
                                                    th.changePage(1);
                                                }
                                            })

                                        }
                                    }
                                },
                                [h('span', {
                                        slot: "open",
                                        domProps: {
                                            innerHTML: '正常'
                                        }
                                    }),
                                    h('span', {
                                        slot: "close",
                                        domProps: {
                                            innerHTML: '冻结'
                                        }
                                    }),
                                ]
                            )
                        }
View Code

InputNumber

render: (h, params) => {
                            return h('div', [
                                h('InputNumber', {
                                    props: {
                                        size: "large",
                                        value: params.row.dSort
                                    },
                                    on: {
                                        'on-change': (value) => {
                                            this.DepartmentType.dId =params.row.dId;
                                            this.DepartmentType.dSort = value;
                                            this.updateSort();
                                            
                                        }
                                    }
                                })
                            ])
                        }
View Code

 

posted @ 2018-12-26 19:55  韦邦杠  阅读(848)  评论(0编辑  收藏  举报