Optimize js code by use Vue.set and Vue.delete

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
This commit is contained in:
Jianhui Zhao
2019-01-21 11:41:25 +08:00
parent d22aec78a9
commit 73f627f0b7
2 changed files with 4 additions and 7 deletions
+3 -6
View File
@@ -250,17 +250,14 @@ export default {
}
},
handleDelCmdEnv(key) {
delete this.cmdData.env[key];
this.cmdData.env = Object.assign({}, this.cmdData.env);
this.$delete(this.cmdData.env, key);
},
handleAddCmdEnv() {
this.cmdData.currentEnv = this.cmdData.currentEnv.trim();
if (this.cmdData.currentEnv != '') {
let e = this.cmdData.currentEnv.split('=');
if (e.length == 2) {
this.cmdData.env[e[0]] = e[1];
this.cmdData.env = Object.assign({}, this.cmdData.env);
}
if (e.length == 2)
this.$set(this.cmdData.env, [e[0]], e[1]);
this.cmdData.currentEnv = '';
}
},
+1 -1
View File
File diff suppressed because one or more lines are too long