无需初始化el-table的:data,直接加:loading="scope.row.installBtn"即可!
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
:loading="scope.row.installBtn" size="mini"
@click="handleInstall(scope.row)"
type="primary">安装
</el-button>
</template>
</el-table-column>
handleInstall(row){
row.installBtn = true
请求...{
row.installBtn = false
}
如果请求用request.js包裹比较特殊,出错时的row.installBtn = false不生效,则:(el-table的:data=dataList)
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
:loading="scope.row.installBtn" size="mini"
@click="handleInstall(scope.row,scope.$index)"
type="primary">安装
</el-button>
</template>
</el-table-column>
handleInstall(row,currentIndex){
this.$set(this.dataList[currentIndex],'installBtn',true)
请求...{
this.$set(this.dataList[currentIndex],'installBtn',false)
}