mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 08:22:17 +00:00
set menuEntry href based on link form -> no href on menus without full url, hash links on menus dont trigger routing anymore; news widget check if carousel exists on mounted nextTick;
This commit is contained in:
@@ -98,11 +98,12 @@ const app = Vue.createApp({
|
||||
const target = event.target.closest('a');
|
||||
|
||||
if (target && this.isInternalRoute(target.href)) {
|
||||
const url = new URL(target.href)
|
||||
|
||||
const path = new URL(target.href).pathname
|
||||
const path = url.pathname
|
||||
const base = this.$router.options.history.base
|
||||
const route = path.replace(base, '') || '/'
|
||||
|
||||
|
||||
// let click event propagate normally if we dont route internally
|
||||
const res = this.$router.resolve(route)
|
||||
if(!res?.matched?.length) return
|
||||
@@ -112,10 +113,13 @@ const app = Vue.createApp({
|
||||
if(this.isMobile) { // toggle the menu
|
||||
const navMain = document.getElementById('nav-main');
|
||||
// fix unwanted toggle from off to on for some links on mobile
|
||||
if(navMain.classList.contains('show')) document.getElementById('nav-main-btn').click();
|
||||
if(navMain.classList.contains('show')){
|
||||
document.getElementById('nav-main-btn').click();
|
||||
}
|
||||
}
|
||||
|
||||
this.$router.push(route);
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -127,6 +131,11 @@ const app = Vue.createApp({
|
||||
},
|
||||
});
|
||||
|
||||
router.beforeEach((to,from) => {
|
||||
console.log('to', to)
|
||||
console.log('from', from)
|
||||
})
|
||||
|
||||
// kind of a bandaid for bad css on some pages to avoid horizontal scroll
|
||||
setScrollbarWidth();
|
||||
app.use(router);
|
||||
|
||||
@@ -74,7 +74,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
|
||||
@@ -101,6 +101,9 @@ export default {
|
||||
}
|
||||
return FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/CisVue/Cms/content/' + this.entry.content_id;
|
||||
},
|
||||
hasFullLink() {
|
||||
return this.link.startsWith(FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router)
|
||||
},
|
||||
target() {
|
||||
if (this.entry.template_kurzbz == 'redirect') {
|
||||
if (!this.entry.content)
|
||||
@@ -201,7 +204,7 @@ export default {
|
||||
<template v-if="hasChilds">
|
||||
<div class="btn-group w-100">
|
||||
<a :target="target"
|
||||
:href="(entry.menu_open)?link:null"
|
||||
:href="(entry.menu_open && hasFullLink)?link:null"
|
||||
@click="toggleCollapse"
|
||||
:class="{
|
||||
'btn btn-default rounded-0 text-start': true,
|
||||
|
||||
@@ -139,11 +139,13 @@ export default {
|
||||
}
|
||||
}).observe(this.$refs.container);
|
||||
}
|
||||
Vue.nextTick(()=>{
|
||||
this.carouselInstance = new bootstrap.Carousel(this.$refs.carousel, {
|
||||
wrap: false, // keep this off even though it actually wraps
|
||||
interval: false
|
||||
});
|
||||
Vue.nextTick(()=> {
|
||||
if(this.$refs.carousel) { // carousel ref might not exist in every widget width/height
|
||||
this.carouselInstance = new bootstrap.Carousel(this.$refs.carousel, {
|
||||
wrap: false, // keep this off even though it actually wraps
|
||||
interval: false
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user