@afeefa/vue-app 0.0.251 → 0.0.252
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.252
|
package/package.json
CHANGED
@@ -46,6 +46,8 @@ class RouteConfigPlugin {
|
|
46
46
|
_router = null
|
47
47
|
_routes = []
|
48
48
|
|
49
|
+
_routeHistory = [];
|
50
|
+
|
49
51
|
_promise = Promise.resolve(true)
|
50
52
|
|
51
53
|
router (options = {}) {
|
@@ -178,6 +180,11 @@ class RouteConfigPlugin {
|
|
178
180
|
}
|
179
181
|
})
|
180
182
|
}
|
183
|
+
|
184
|
+
this._router.beforeEach((to, from, next) => {
|
185
|
+
this._routeHistory.push(to)
|
186
|
+
next()
|
187
|
+
})
|
181
188
|
})
|
182
189
|
})
|
183
190
|
|
@@ -353,6 +360,14 @@ class RouteConfigPlugin {
|
|
353
360
|
}
|
354
361
|
return new BreadcrumbSetDefinition(options).getDefinitions()
|
355
362
|
}
|
363
|
+
|
364
|
+
getRouteHistory () {
|
365
|
+
return this._routeHistory
|
366
|
+
}
|
367
|
+
|
368
|
+
removeFromRouteHistoryAfterIndex (index) {
|
369
|
+
this._routeHistory.splice(index + 1)
|
370
|
+
}
|
356
371
|
}
|
357
372
|
|
358
373
|
export const routeConfigPlugin = new RouteConfigPlugin()
|
@@ -7,7 +7,7 @@
|
|
7
7
|
color="#F4F4F4"
|
8
8
|
title="Zurück"
|
9
9
|
class="mr-n2"
|
10
|
-
@click="
|
10
|
+
@click="goToLastNamedRoute()"
|
11
11
|
>
|
12
12
|
<v-icon>
|
13
13
|
$arrowLeftIcon
|
@@ -34,6 +34,7 @@
|
|
34
34
|
|
35
35
|
<script>
|
36
36
|
import { Component, Vue } from '@a-vue'
|
37
|
+
import { routeConfigPlugin } from '@a-vue/plugins/route-config/RouteConfigPlugin'
|
37
38
|
|
38
39
|
@Component({
|
39
40
|
props: ['back', 'icon', 'title', 'subtitle', 'detail']
|
@@ -57,6 +58,21 @@ export default class appBarTitle extends Vue {
|
|
57
58
|
getButtonBar () {
|
58
59
|
return document.getElementById('appBarTitleContainer')
|
59
60
|
}
|
61
|
+
|
62
|
+
goToLastNamedRoute () {
|
63
|
+
const currentRouteName = this.$route.name
|
64
|
+
const historyStack = routeConfigPlugin.getRouteHistory()
|
65
|
+
|
66
|
+
// Durchlaufe die Historie rückwärts, um die letzte benannte Route zu finden, die sich vom aktuellen Namen unterscheidet
|
67
|
+
for (let i = historyStack.length - 2; i >= 0; i--) {
|
68
|
+
const route = historyStack[i]
|
69
|
+
if (route.name && route.name !== currentRouteName) {
|
70
|
+
this.$router.push({ name: route.name })
|
71
|
+
routeConfigPlugin.removeFromRouteHistoryAfterIndex(i)
|
72
|
+
return
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
60
76
|
}
|
61
77
|
</script>
|
62
78
|
|