FhcApp uses vueRouter4; CisApp checks for global router instance and routes internally as long as a path/routename/component setup is defined, if that is not the case use the provided href link; WIP moving apps like Profil, MyLv etc into components to be navigated by FhcApp;

This commit is contained in:
Johann Hoffmann
2025-01-15 14:10:08 +01:00
parent bae7b330f8
commit f60f735fa8
11 changed files with 274 additions and 37 deletions
+16 -3
View File
@@ -15,7 +15,7 @@ export default {
urlCount:0,
}
},
inject: ['makeParentContentActive', 'setActiveEntry','addUrlCount'],
inject: ['makeParentContentActive', 'setActiveEntry','addUrlCount', 'routeMap'],
watch:{
highestMatchingUrlCount: function(newValue)
{
@@ -77,6 +77,7 @@ export default {
return '';
let xmlDoc = (new DOMParser()).parseFromString(this.entry.content,"text/xml");
let url = xmlDoc.getElementsByTagName('url')[0];
if (!url)
return '';
// TODO(chris): replace get params
@@ -184,7 +185,19 @@ export default {
{
this.setActiveEntry(this.entry.content_id);
}
}
},
handleClick(e) {
// TODO: this needs to be done more resilient
const linkParts = this.link.split('/')
const routePath = linkParts.reverse()[0]
const r = this.routeMap.find(route => route.paths.includes(routePath))
if(window.fhcVueRouter && r) {
const re = new CustomEvent("fhcnavigate", { detail: r.routeName })
window.dispatchEvent(re)
} else {
location.href = this.link
}
}
},
mounted() {
if (this.$refs.children) {
@@ -224,7 +237,7 @@ export default {
</ul>
</template>
<a v-else
:href="link"
@click="handleClick"
:target="target"
:class="{
'btn btn-default rounded-0 w-100 text-start': true,