refactor: Api Keys 前端页面修改

This commit is contained in:
Captain.B 2020-08-19 11:50:08 +08:00
parent a435a5194d
commit b5fab0f8a6
1 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@
<div> <div>
<el-tooltip :content="$t('api_test.copied')" manual v-model="scope.row.visible" placement="top" <el-tooltip :content="$t('api_test.copied')" manual v-model="scope.row.visible" placement="top"
:visible-arrow="false"> :visible-arrow="false">
<i class="el-icon-copy-document copy" @click="copy(scope.row, 'accessKey')"/> <i class="el-icon-copy-document copy" @click="copy(scope.row, 'accessKey', 'visible')"/>
</el-tooltip> </el-tooltip>
</div> </div>
</div> </div>
@ -63,7 +63,7 @@
{{ currentRow.secretKey }} {{ currentRow.secretKey }}
<el-tooltip :content="$t('api_test.copied')" manual v-model="currentRow.visible2" placement="top" <el-tooltip :content="$t('api_test.copied')" manual v-model="currentRow.visible2" placement="top"
:visible-arrow="false"> :visible-arrow="false">
<i class="el-icon-copy-document copy" @click="copy(currentRow, 'secretKey')"/> <i class="el-icon-copy-document copy" @click="copy(currentRow, 'secretKey', 'visible2')"/>
</el-tooltip> </el-tooltip>
</div> </div>
</el-dialog> </el-dialog>
@ -145,7 +145,7 @@ export default {
this.apiKeysVisible = true; this.apiKeysVisible = true;
this.currentRow = row; this.currentRow = row;
}, },
copy(row, key) { copy(row, key, visible) {
let input = document.createElement("input"); let input = document.createElement("input");
document.body.appendChild(input); document.body.appendChild(input);
input.value = row[key]; input.value = row[key];
@ -155,9 +155,9 @@ export default {
} }
document.execCommand("copy"); document.execCommand("copy");
document.body.removeChild(input); document.body.removeChild(input);
row.visible = true; row[visible] = true;
setTimeout(() => { setTimeout(() => {
row.visible = false; row[visible] = false;
}, 1000); }, 1000);
}, },
} }