@afeefa/vue-app 0.0.106 → 0.0.107
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.107
|
package/package.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Component, Vue } from '@a-vue'
|
1
|
+
import { Component, Watch, Vue } from '@a-vue'
|
2
2
|
|
3
3
|
Component.registerHooks([
|
4
4
|
'beforeRouteEnter',
|
@@ -36,39 +36,36 @@ function load (route) {
|
|
36
36
|
|
37
37
|
@Component
|
38
38
|
export class DataRouteMixin extends Vue {
|
39
|
-
drm_isLoaded = false
|
40
|
-
|
41
39
|
async beforeRouteEnter (to, from, next) {
|
42
40
|
routerHookCalled = true
|
43
41
|
const result = await load(to)
|
44
|
-
|
45
42
|
next(vm => {
|
46
43
|
if (result !== false) {
|
47
44
|
vm.drm_onLoad(result)
|
48
|
-
vm.drm_isLoaded = true
|
49
45
|
}
|
50
46
|
routerHookCalled = false
|
51
47
|
})
|
52
48
|
}
|
53
49
|
|
54
|
-
/**
|
55
|
-
* triggered both, if route name or route params change
|
56
|
-
@Watch('$route.params')
|
57
|
-
async routeParamsChanged () {
|
58
|
-
if (routerHookCalled) {
|
59
|
-
return
|
60
|
-
}
|
61
50
|
|
62
|
-
|
63
|
-
|
51
|
+
// watches (if defined) route idKey and reloads data if changed
|
52
|
+
@Watch('drm_id')
|
53
|
+
async routeParamsChanged () {
|
54
|
+
if (routerHookCalled) {
|
55
|
+
return
|
56
|
+
}
|
57
|
+
|
58
|
+
const result = await load(this.$route)
|
59
|
+
|
60
|
+
if (result !== false) {
|
61
|
+
this.drm_onLoad(result)
|
62
|
+
}
|
63
|
+
}
|
64
64
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
}
|
70
|
-
}
|
71
|
-
*/
|
65
|
+
// return route config idKey
|
66
|
+
get drm_id () {
|
67
|
+
return this.$route.params[this.$routeDefinition.idKey]
|
68
|
+
}
|
72
69
|
|
73
70
|
drm_onLoad (result) {
|
74
71
|
onLoadCallback(this, result)
|