!36 perf: 去除临时变量 _this

Merge pull request !36 from YangFong/perf-obj
This commit is contained in:
sakuya 2022-08-11 01:59:08 +00:00 committed by Gitee
commit cb164d6f0b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 17 additions and 18 deletions

View File

@ -65,11 +65,10 @@
})
},
contextMenuVisible(value) {
var _this = this;
var cm = function(e){
let sp = document.getElementById("contextmenu");
const cm = (e) => {
const sp = document.getElementById("contextmenu");
if (sp && !sp.contains(e.target)) {
_this.closeMenu()
this.closeMenu()
}
}
if (value) {
@ -161,23 +160,23 @@
},
//TAB
refreshTab() {
var nowTag = this.contextMenuItem;
this.contextMenuVisible = false
const nowTag = this.contextMenuItem;
//
if(this.$route.fullPath != nowTag.fullPath){
if (this.$route.fullPath !== nowTag.fullPath) {
this.$router.push({
path: nowTag.fullPath,
query: nowTag.query
})
}
this.$store.commit("refreshIframe", nowTag)
var _this = this;
setTimeout(function() {
_this.$store.commit("removeKeepLive", nowTag.name)
_this.$store.commit("setRouteShow", false)
_this.$nextTick(() => {
_this.$store.commit("pushKeepLive",nowTag.name)
_this.$store.commit("setRouteShow", true)
setTimeout(() => {
this.$store.commit("removeKeepLive", nowTag.name)
this.$store.commit("setRouteShow", false)
this.$nextTick(() => {
this.$store.commit("pushKeepLive", nowTag.name)
this.$store.commit("setRouteShow", true)
})
}, 0);
},