|
@@ -10,7 +10,12 @@
|
|
|
:key="index"
|
|
|
@contextmenu.prevent.native="openMenu(tag, $event)"
|
|
|
>
|
|
|
- <span :title="generateTitle(tag.title)" class="item" @click="changeTag(tag)">{{ generateTitle(tag.title) }}</span>
|
|
|
+ <span
|
|
|
+ :title="generateTitle(tag.title)"
|
|
|
+ class="item"
|
|
|
+ @click="changeTag(tag)"
|
|
|
+ >{{ generateTitle(tag.title) }}</span
|
|
|
+ >
|
|
|
<!-- v-if="index == Array.from(visitedViews).length -1" -->
|
|
|
<span
|
|
|
class="el-icon-close icon"
|
|
@@ -35,7 +40,7 @@
|
|
|
import ScrollPane from "@/components/ScrollPane";
|
|
|
import { generateTitle } from "@/utils/i18n";
|
|
|
import { Searchs } from "@/helpers";
|
|
|
-let activeKey = ''
|
|
|
+let activeKey = "";
|
|
|
export default {
|
|
|
name: "TagsView",
|
|
|
components: { ScrollPane },
|
|
@@ -61,22 +66,22 @@ export default {
|
|
|
this.addViewTags();
|
|
|
this.moveToCurrentTag();
|
|
|
if (!activeKey && !this.$store.state.tagsView.isBack) {
|
|
|
- const s = new Searchs()
|
|
|
- const keys = [this.$route.path]
|
|
|
+ const s = new Searchs();
|
|
|
+ const keys = [this.$route.path];
|
|
|
for (const key in s.searchs) {
|
|
|
if (Object.hasOwnProperty.call(s.searchs, key)) {
|
|
|
const item = s.searchs[key];
|
|
|
if (item.bind === this.$route.path) {
|
|
|
- keys.push(key)
|
|
|
+ keys.push(key);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
for (const item of keys) {
|
|
|
- s.removeByKey(item)
|
|
|
+ s.removeByKey(item);
|
|
|
}
|
|
|
}
|
|
|
- this.$store.commit('SET_IS_BACK', false)
|
|
|
- activeKey = ''
|
|
|
+ this.$store.commit("SET_IS_BACK", false);
|
|
|
+ activeKey = "";
|
|
|
},
|
|
|
visible(value) {
|
|
|
if (value) {
|
|
@@ -109,16 +114,20 @@ export default {
|
|
|
const searchs = new Searchs();
|
|
|
const allSearch = searchs.getSearchs();
|
|
|
const sks = Object.keys(allSearch);
|
|
|
- let route = this.$route
|
|
|
+ let route = this.$route;
|
|
|
for (const item of sks) {
|
|
|
if (!(keys.includes(item) || keys.includes(allSearch[item].bind))) {
|
|
|
searchs.removeByKey(item);
|
|
|
}
|
|
|
|
|
|
- let tempSaveKeyList = item.split('|')
|
|
|
+ let tempSaveKeyList = item.split("|");
|
|
|
// 大于1说明的特殊标识编号
|
|
|
- if(tempSaveKeyList.length > 1) {
|
|
|
- if(allSearch[item] && route.path == allSearch[item].bind && route.query[tempSaveKeyList[1]] != tempSaveKeyList[2]) {
|
|
|
+ if (tempSaveKeyList.length > 1) {
|
|
|
+ if (
|
|
|
+ allSearch[item] &&
|
|
|
+ route.path == allSearch[item].bind &&
|
|
|
+ route.query[tempSaveKeyList[1]] != tempSaveKeyList[2]
|
|
|
+ ) {
|
|
|
searchs.removeByKey(item);
|
|
|
}
|
|
|
}
|
|
@@ -139,26 +148,31 @@ export default {
|
|
|
for (const tag of tags) {
|
|
|
if (tag.path === this.$route.path) {
|
|
|
this.$refs.scrollPane.moveToTarget(tag.$el);
|
|
|
+ // const searchs = new Searchs();
|
|
|
+ // const allSearch = searchs.getSearchs();
|
|
|
+ // console.log(allSearch)
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
closeSelectedTag(view) {
|
|
|
- activeKey = '1'
|
|
|
+ activeKey = "1";
|
|
|
|
|
|
const searchs = new Searchs();
|
|
|
searchs.remove(this.$route.path);
|
|
|
- this.$store.dispatch("delVisitedViews", {...view, dontNeedSave: true}).then((views) => {
|
|
|
- if (this.isActive(view)) {
|
|
|
- const latestView = views.slice(-1)[0];
|
|
|
- if (latestView) {
|
|
|
- this.$router.push(latestView.fullPath);
|
|
|
- } else {
|
|
|
- this.$router.push("/");
|
|
|
+ this.$store
|
|
|
+ .dispatch("delVisitedViews", { ...view, dontNeedSave: true })
|
|
|
+ .then((views) => {
|
|
|
+ if (this.isActive(view)) {
|
|
|
+ const latestView = views.slice(-1)[0];
|
|
|
+ if (latestView) {
|
|
|
+ this.$router.push(latestView.fullPath);
|
|
|
+ } else {
|
|
|
+ this.$router.push("/");
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
},
|
|
|
closeOthersTags() {
|
|
|
this.$router.push(this.selectedTag.path);
|
|
@@ -180,25 +194,24 @@ export default {
|
|
|
this.visible = false;
|
|
|
},
|
|
|
changeTag(tag) {
|
|
|
- console.log(tag)
|
|
|
- activeKey = this.getSearchsByRealPath(tag)
|
|
|
-
|
|
|
+ console.log(tag);
|
|
|
+ activeKey = this.getSearchsByRealPath(tag);
|
|
|
},
|
|
|
getSearchsByRealPath(tag) {
|
|
|
- const searchs = new Searchs()
|
|
|
- let keyName = ''
|
|
|
+ const searchs = new Searchs();
|
|
|
+ let keyName = "";
|
|
|
|
|
|
- console.log( searchs.searchs)
|
|
|
+ console.log(searchs.searchs);
|
|
|
for (const key in searchs.searchs) {
|
|
|
if (Object.hasOwnProperty.call(searchs.searchs, key)) {
|
|
|
const item = searchs.searchs[key];
|
|
|
if (tag.path === key || item.bind === tag.path) {
|
|
|
- keyName = item.bind || tag.path
|
|
|
+ keyName = item.bind || tag.path;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// this.activeKey = keyName
|
|
|
- return keyName
|
|
|
+ return keyName;
|
|
|
},
|
|
|
async refresh(view) {
|
|
|
await this.reloads();
|
|
@@ -246,7 +259,7 @@ export default {
|
|
|
z-index: 2;
|
|
|
|
|
|
&::before {
|
|
|
- border-right: 0;
|
|
|
+ border-right: 0;
|
|
|
}
|
|
|
}
|
|
|
&::before {
|
|
@@ -285,7 +298,7 @@ export default {
|
|
|
//reset element css of el-icon-close
|
|
|
.tags-view-wrapper {
|
|
|
.tags-view-item {
|
|
|
- .item{
|
|
|
+ .item {
|
|
|
flex: 1;
|
|
|
text-overflow: ellipsis;
|
|
|
overflow: hidden;
|