|
@@ -10,7 +10,7 @@
|
|
:key="index"
|
|
:key="index"
|
|
@contextmenu.prevent.native="openMenu(tag, $event)"
|
|
@contextmenu.prevent.native="openMenu(tag, $event)"
|
|
>
|
|
>
|
|
- {{ generateTitle(tag.title) }}
|
|
|
|
|
|
+ <span :title="generateTitle(tag.title)" class="item" @click="changeTag(tag)">{{ generateTitle(tag.title) }}</span>
|
|
<!-- v-if="index == Array.from(visitedViews).length -1" -->
|
|
<!-- v-if="index == Array.from(visitedViews).length -1" -->
|
|
<span
|
|
<span
|
|
class="el-icon-close icon"
|
|
class="el-icon-close icon"
|
|
@@ -35,7 +35,7 @@
|
|
import ScrollPane from "@/components/ScrollPane";
|
|
import ScrollPane from "@/components/ScrollPane";
|
|
import { generateTitle } from "@/utils/i18n";
|
|
import { generateTitle } from "@/utils/i18n";
|
|
import { Searchs } from "@/helpers";
|
|
import { Searchs } from "@/helpers";
|
|
-
|
|
|
|
|
|
+let activeKey = ''
|
|
export default {
|
|
export default {
|
|
name: "TagsView",
|
|
name: "TagsView",
|
|
components: { ScrollPane },
|
|
components: { ScrollPane },
|
|
@@ -44,6 +44,8 @@ export default {
|
|
visible: false,
|
|
visible: false,
|
|
top: 0,
|
|
top: 0,
|
|
left: 0,
|
|
left: 0,
|
|
|
|
+ activeKey: null,
|
|
|
|
+ activeTag: null,
|
|
selectedTag: {},
|
|
selectedTag: {},
|
|
};
|
|
};
|
|
},
|
|
},
|
|
@@ -58,6 +60,22 @@ export default {
|
|
$route() {
|
|
$route() {
|
|
this.addViewTags();
|
|
this.addViewTags();
|
|
this.moveToCurrentTag();
|
|
this.moveToCurrentTag();
|
|
|
|
+ if (!activeKey) {
|
|
|
|
+ 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)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (const item of keys) {
|
|
|
|
+ s.removeByKey(item)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ activeKey = ''
|
|
},
|
|
},
|
|
visible(value) {
|
|
visible(value) {
|
|
if (value) {
|
|
if (value) {
|
|
@@ -90,10 +108,19 @@ export default {
|
|
const searchs = new Searchs();
|
|
const searchs = new Searchs();
|
|
const allSearch = searchs.getSearchs();
|
|
const allSearch = searchs.getSearchs();
|
|
const sks = Object.keys(allSearch);
|
|
const sks = Object.keys(allSearch);
|
|
|
|
+ let route = this.$route
|
|
for (const item of sks) {
|
|
for (const item of sks) {
|
|
if (!(keys.includes(item) || keys.includes(allSearch[item].bind))) {
|
|
if (!(keys.includes(item) || keys.includes(allSearch[item].bind))) {
|
|
searchs.removeByKey(item);
|
|
searchs.removeByKey(item);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ let tempSaveKeyList = item.split('|')
|
|
|
|
+ // 大于1说明的特殊标识编号
|
|
|
|
+ if(tempSaveKeyList.length > 1) {
|
|
|
|
+ if(allSearch[item] && route.path == allSearch[item].bind && route.query[tempSaveKeyList[1]] != tempSaveKeyList[2]) {
|
|
|
|
+ searchs.removeByKey(item);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async addViewTags() {
|
|
async addViewTags() {
|
|
@@ -149,6 +176,23 @@ export default {
|
|
closeMenu() {
|
|
closeMenu() {
|
|
this.visible = false;
|
|
this.visible = false;
|
|
},
|
|
},
|
|
|
|
+ changeTag(tag) {
|
|
|
|
+ activeKey = this.getSearchsByRealPath(tag)
|
|
|
|
+ },
|
|
|
|
+ getSearchsByRealPath(tag) {
|
|
|
|
+ const searchs = new Searchs()
|
|
|
|
+ let keyName = ''
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // this.activeKey = keyName
|
|
|
|
+ return keyName
|
|
|
|
+ },
|
|
async refresh(view) {
|
|
async refresh(view) {
|
|
await this.reloads();
|
|
await this.reloads();
|
|
},
|
|
},
|
|
@@ -165,6 +209,7 @@ export default {
|
|
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04);
|
|
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04);
|
|
.tags-view-item {
|
|
.tags-view-item {
|
|
min-width: 120px;
|
|
min-width: 120px;
|
|
|
|
+ display: inline-flex;
|
|
.icon {
|
|
.icon {
|
|
font-size: 20px;
|
|
font-size: 20px;
|
|
position: relative;
|
|
position: relative;
|
|
@@ -173,7 +218,7 @@ export default {
|
|
margin-right: 5px;
|
|
margin-right: 5px;
|
|
}
|
|
}
|
|
border-radius: 5px 5px 0 0;
|
|
border-radius: 5px 5px 0 0;
|
|
- display: inline-block;
|
|
|
|
|
|
+ // display: inline-block;
|
|
position: relative;
|
|
position: relative;
|
|
height: 30px;
|
|
height: 30px;
|
|
line-height: 30px;
|
|
line-height: 30px;
|
|
@@ -233,6 +278,12 @@ export default {
|
|
//reset element css of el-icon-close
|
|
//reset element css of el-icon-close
|
|
.tags-view-wrapper {
|
|
.tags-view-wrapper {
|
|
.tags-view-item {
|
|
.tags-view-item {
|
|
|
|
+ .item{
|
|
|
|
+ flex: 1;
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ display: inline-block;
|
|
|
|
+ }
|
|
.el-icon-close {
|
|
.el-icon-close {
|
|
width: 16px;
|
|
width: 16px;
|
|
height: 16px;
|
|
height: 16px;
|