DWQA QuestionsCategory: ProgramHow to control the buttons rendered by the iView render function according to the logo
Tai Yu asked 1 month ago

How to control the buttons rendered by the iView render function according to the logo
1. Enable by default, display disable button
2. Click disable. The disable button will change to enable after success
3. Click enable. After success, the enable button will change to the disable button
How to realize it through judgment?

{Title: 'operation', key: 'action', width: 250, align: 'center', render: function (h, params){
                    return h('div', [
                                h('Button', {
                                    props: {
                                        type:'primary',
                                        size:'small'
                                    },
                                    style: {
                                        marginRight:'8px'
                                    },
                                    on:{
                                        click:function(){
                                            mSet.ableGrade(params.row);
                                        }
                                    }
                                }, 'enable'),
                                h('Button', {
                                    props: {
                                        type:'info',
                                        size:'small'
                                    },
                                    style: {
                                        marginRight:'8px'
                                    },
                                    on:{
                                        click:function(){
                                            mSet.disableGrade(params.row);
                                        }
                                    }
                                }, 'Disable'),
                                h('Button', {
                                    props: {
                                        type:'warning',
                                        size:'small'
                                    },
                                    style: {
                                        marginRight:'8px'
                                    },
                                    on:{
                                        click:function(){
                                            mSet.editGrade(params.row);
                                        }
                                    }
                                }, 'Edit'),
                                h('Button', {
                                    props: {
                                        type:'error',
                                        size:'small'
                                    },
                                    on:{
                                        click:function(){
                                            mSet.singleDel(params.row,params.index);
                                        }
                                    }
                                }, 'Delete')
                            ]);
                    }
                }
1 Answers
Best Answer
Aresn answered 1 month ago

Use if and else statements to judge the nodes to be rendered. Read the Vue documentation.

Xiao Xiao Wang replied 1 month ago

There was no examination at all..