Skip to content

Commit

Permalink
changing the way of loading custom components
Browse files Browse the repository at this point in the history
  • Loading branch information
ashaban committed Sep 23, 2023
1 parent 960294f commit 8c505d9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
2 changes: 2 additions & 0 deletions dhis2App/js/app.b8525fb3.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dhis2App/js/app.b8525fb3.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions gofr-backend/lib/gofr-backend-site/gui/js/app.b8525fb3.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

34 changes: 27 additions & 7 deletions gofr-gui/src/views/custom.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
<template>
<component :is="currentComponent"></component>
<component
:is="currentComponent"
:queries="this.$route.query"
/>
</template>
<script>
export default {
props: ["path", "component"],
data() {
return {
currentComponent: () => import(`../../site/${this.$route.params.path}/${this.$route.params.component}.vue`)
props: ["component"],
data() {
return {
currentComponent: ""
}
},
created() {
let componentPath = ""
if(this.$route.query.path) {
let actualPath = this.$route.query.path.split('/')
for(let path of actualPath) {
if(!path) {
continue
}
componentPath += "/" + path
}
}
componentPath += "/" + this.$route.params.component
if(!componentPath.endsWith(".vue")) {
componentPath += ".vue"
}
this.currentComponent = () => import(`@/site${componentPath}`)
}
}
}
</script>>
</script>

0 comments on commit 8c505d9

Please sign in to comment.