-
-
+ return tags
+}
+const initTags = () => {
+ let routesNew = routes.value
+ let affixTag = (affixTags.value = filterAffixTags(routesNew))
+ for (const tag of affixTag) {
+ if (tag.name) {
+ TagsViewStore.addVisitedView(tag)
+ }
+ }
+}
+onMounted(()=>{
+ initTags()
+ addTags()
+})
+watch(route, () => {
+ addTags()
+})
+let tabIndex = 2
+const activeTabsValue = computed({
+ get: () => {
+ return TagsViewStore.activeTabsValue;
+ },
+ set: val => {
+ TagsViewStore.setTabsMenuValue(val);
+ }
+});
+function toLastView(activeTabPath) {
+ let index = visitedViews.value.findIndex(item=>item.path===activeTabPath)
+ const nextTab = visitedViews.value[index + 1] || visitedViews.value[index - 1];
+ if (!nextTab) return;
+ router.push(nextTab.path);
+ TagsViewStore.addVisitedView(nextTab)
+}
+// Tab Click
+const tabClick = (tabItem: TabsPaneContext) => {
+ let path = tabItem.props.name as string;
+ router.push(path);
+};
+const isActive = (path) => {
+ return path === route.path
+}
+const removeTab = async (activeTabPath: string) => {
+ if (isActive(activeTabPath)) {
+ toLastView(activeTabPath)
+ }
+ await TagsViewStore.delView(activeTabPath)
+}
+
diff --git a/src/layout/TagsView/index1.vue b/src/layout/TagsView/index1.vue
new file mode 100644
index 0000000..81e2a24
--- /dev/null
+++ b/src/layout/TagsView/index1.vue
@@ -0,0 +1,317 @@
+
+
+
+
+
+
+
diff --git a/src/layout/index.vue b/src/layout/index.vue
index fccf469..064a9bd 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -8,7 +8,7 @@
hideSliderLayout: mode === 'horizontal',
}"
>
-
+
diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts
index be72bbd..e9d3729 100644
--- a/src/store/modules/tagsView.ts
+++ b/src/store/modules/tagsView.ts
@@ -1,11 +1,13 @@
import {defineStore} from 'pinia'
-
+import { useRouter } from "vue-router";
+const router = useRouter()
export const useTagsViewStore = defineStore({
// id: 必须的,在所有 Store 中唯一
id:'tagsViewState',
// state: 返回对象的函数
state: ()=>({
+ activeTabsValue:'/home',
visitedViews:[],
cachedViews:[],
@@ -13,6 +15,9 @@ export const useTagsViewStore = defineStore({
getters: {},
// 可以同步 也可以异步
actions:{
+ setTabsMenuValue(val){
+ this.activeTabsValue = val
+ },
addView(view){
this.addVisitedView(view)
},
@@ -23,7 +28,9 @@ export const useTagsViewStore = defineStore({
})
},
addVisitedView(view){
+ this.setTabsMenuValue(view.path);
if (this.visitedViews.some(v => v.path === view.path)) return
+
this.visitedViews.push(
Object.assign({}, view, {
title: view.meta.title || 'no-name'
@@ -32,11 +39,12 @@ export const useTagsViewStore = defineStore({
if (view.meta.keepAlive) {
this.cachedViews.push(view.name)
}
+
},
- delView(view){
+ delView(activeTabPath){
return new Promise(resolve => {
- this.delVisitedView(view)
- this.delCachedView(view)
+ this.delVisitedView(activeTabPath)
+ this.delCachedView(activeTabPath)
resolve({
visitedViews: [...this.visitedViews],
cachedViews: [...this.cachedViews]
@@ -44,13 +52,13 @@ export const useTagsViewStore = defineStore({
})
},
- delVisitedView(view){
+ delVisitedView(path){
return new Promise(resolve => {
this.visitedViews = this.visitedViews.filter(v=>{
- return (v.path !== view.path||v.meta.affix)
+ return (v.path !== path||v.meta.affix)
})
this.cachedViews = this.cachedViews.filter(v=>{
- return (v.path !== view.path||v.meta.affix)
+ return (v.path !== path||v.meta.affix)
})
resolve([...this.visitedViews])
})
@@ -74,6 +82,10 @@ export const useTagsViewStore = defineStore({
resolve([...this.visitedViews])
})
},
+ async goHome() {
+ router.push('/home');
+ this.activeTabsValue = '/home';
+ },
updateVisitedView(view){
for (let v of this.visitedViews) {
if (v.path === view.path) {
diff --git a/src/views/charts/components/js/data.js b/src/views/charts/components/js/data.js
index ceb644a..94ac736 100644
--- a/src/views/charts/components/js/data.js
+++ b/src/views/charts/components/js/data.js
@@ -5,33 +5,33 @@ export const cityIconData = [
value: [88.999903, 43.607078],
},
{
- adcode: 150000,
+ // adcode: 150000,
name: '内蒙古自治区',
value: [119.24787, 42.205741],
},
,
{
- adcode: 150000,
+ // adcode: 150000,
name: '内蒙古自治区',
value: [110.627161, 41.16628],
},
{
- adcode: 540000,
+ // adcode: 540000,
name: '西藏自治区',
value: [89.483714, 30.251951],
},
{
- adcode: 630000,
+ // adcode: 630000,
name: '青海省',
value: [102.064693, 37.084008],
},
{
- adcode: 530000,
+ // adcode: 530000,
name: '云南省',
value: [102.187665, 25.083688],
},
{
- adcode: 610000,
+ // adcode: 610000,
name: '陕西省',
value: [109.20663, 35.018625],
},
diff --git a/src/views/login/index.scss b/src/views/login/index.scss
index 5e3288a..8c541ab 100644
--- a/src/views/login/index.scss
+++ b/src/views/login/index.scss
@@ -1,5 +1,5 @@
$dark_gray: #889aa4;
-::v-deep(input) {
+:deep(input) {
background: transparent;
border: 0;
color: white;