iview表格按钮renter函数

版权声明:本文为QQ帝国原创博客,非经本人同意,且勿转载。。 https://blog.csdn.net/QQ_Empire/article/details/85324736

 1、判断按钮显示隐藏

 render: (h, params) => {
                            let state = params.row.returnstate;
                            if(state=="已退回"){
                                return h('div', [
                                    h('Button', {
                                        props: {
                                            type: 'success',
                                            size: 'small'
                                        },
                                        style: {
                                            marginRight: '5px'
                                        },
                                        on: {
                                            click: () => {
                                                this.show(params.index)
                                            }
                                        }
                                    }, '查看'),
                                   
                                ]);
                            }else{
                                return h('div', [
                                    
                                    h('Button', {
                                        props: {
                                            type: 'error',
                                            size: 'small'
                                        },
                                        on: {
                                            click: () => {
                                                this.remove(params.index)
                                            }
                                        }
                                    }, '退回')
                                ]);
                            }
                           
                        }

2、根据状态,改变字体样式

{
                        title: '二审状态',
                        key: 'sinststate',
                       render:(h,params)=>{  
                          let tmpStr = "";                     
                          let status = params.row.finststate;
                          tmpStr=status==0?"未审核":(status==1?"已审核":status==2?"被退回":"无效状态");                           
                          return h('span',{
                              style:{
                                 color: (status==0)?"#D2B303":(status==1?"#03A71F":status==2?"#FD0904":"#000"),
                                
                              }
                          },tmpStr)
                        }
                    },

猜你喜欢

转载自blog.csdn.net/QQ_Empire/article/details/85324736
今日推荐