How to configure the loading attribute of button in iview table

button rendered by render adds the loading attribute so that all buttons will be in loading state after triggering the event. Is there any way to make only the button that is currently clicked loading?

{
                        title: "",
                        key: "action",
                        width: 150,
                        align: "center",
                        render: (h, params) => {
                            return h("div", [
                                h("Button", {
                                    props: {
                                        type: "primary",
                                        size: "small"
                                    },
                                    style: {
                                        marginRight: "5px"
                                    },
                                    on: {
                                        click: () => {
                                            this.edit(params.index, params.row)
                                        }
                                    }
                                }, ""),
                                h("Button", {
                                    props: {
                                        type: "error",
                                        size: "small",
                                        loading: this.loading
                                    },
                                    on: {
                                        click: () => {
                                            this.remove(params.index, params.row)
                                        }
                                    }
                                }, "")
                            ]);
                        }
                    }
Mar.13,2021

have you solved it? I now have this problem


you define loading as an array, and then loading:this.loading [params.index], you can change the corresponding value of the loading array according to the params.index passed in.


each btn holds a loading


solve this problem


first define an array to store
for (let i = 0; I < vm.infoMangementPage.pageSize; iPP) {

 vm.UploadLoading[i] = false;

}
const infoMangementReport = (vm, h, currentRow, index, params) = > {

    return h('Button', {
        props: {
            type: 'primary',
            loading: vm.UploadLoading[index]
        },
        style: {
            margin: '10px 0 0 10px'
        },
        on: {
            'click': () => {
                vm.$set(vm.UploadLoading,index,true);
                            
                getMethod('', {
                    params: {
                       
                    }
                }).then(res => {
                    vm.$set(vm.UploadLoading,index,false);
                   
                })     
            }
        }
       
    }, '')
}

it is easier to use jsx,
clipboard.png, and the actions that follow in the click event control the attribute status of the loading.


render: (h, params) => {
                        return h("div", [
                            h(
                                "Button",
                                {
                                    props: {
                                        type: "primary",
                                        size: "small",
                                        ghost: true,
                                        loading:params.row.$isLoading
                                    },
                                    on: {
                                        click: () => {
                                            this.processClick(params);
                                        }
                                    }
                                },
                                ""
                            )
                        ]);
                    }
                    

methods:{
    processClick(params){
        this.$set(params.row, '$isLoading', true)
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e940-2c451.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e940-2c451.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?