|
@@ -1,4 +1,5 @@
|
|
|
import { mapState } from 'vuex'
|
|
|
+import VisitedModelTransform from '@/utils/mixins/tran-visited'
|
|
|
|
|
|
class VisitedPathItem {
|
|
|
constructor (path, search) {
|
|
@@ -8,6 +9,8 @@ class VisitedPathItem {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const TranModel = new VisitedModelTransform()
|
|
|
+
|
|
|
export const mixinVisited = {
|
|
|
computed: {
|
|
|
...mapState({
|
|
@@ -19,7 +22,7 @@ export const mixinVisited = {
|
|
|
},
|
|
|
methods: {
|
|
|
createPathItem (path, search) {
|
|
|
- return new VisitedPathItem(path, search)
|
|
|
+ return TranModel.transformItem(new VisitedPathItem(path, search))
|
|
|
},
|
|
|
// 从判断 path 是否访问过
|
|
|
// 参数path为 VisitedPathItem new 出来的实例
|
|
@@ -38,8 +41,8 @@ export const mixinVisited = {
|
|
|
return sameIndex
|
|
|
},
|
|
|
comparePath (basePath, newPath) {
|
|
|
- const pathSame = basePath.path === newPath.path
|
|
|
- const searchSame = basePath.search === newPath.search
|
|
|
+ const pathSame = basePath.type === newPath.type
|
|
|
+ const searchSame = basePath.id === newPath.id
|
|
|
|
|
|
return pathSame && searchSame
|
|
|
},
|