鍍金池/ 問答/HTML/ iview table 里button的loading屬性如何配置

iview table 里button的loading屬性如何配置

render渲染的button這樣添加loading屬性,觸發(fā)事件后所有的按鈕都會是loading狀態(tài),有什么方法可以只讓當(dāng)前被點擊的按鈕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)
                                        }
                                    }
                                }, '刪除')
                            ]);
                        }
                    }
回答
編輯回答
愛礙唉

你將loading定義為數(shù)組,然后loading:this.loading[params.index],你在根據(jù)點擊傳入的params.index來改變loading數(shù)組對應(yīng)的值不就好了

2018年5月18日 13:47
編輯回答
尛憇藌

你解決了嗎?我現(xiàn)在也遇到這個問題了

2018年2月11日 15:49
編輯回答
練命

每個btn持有一個loading

2017年8月27日 15:19
編輯回答
孤影

解決了么 我也遇到這個問題了

2017年4月18日 15:53