Fixed index page for static page and simple routing issue.
parent
1671d19134
commit
d7621aa1d1
|
@ -2,14 +2,13 @@
|
||||||
<div id="app-top">
|
<div id="app-top">
|
||||||
<nav class="navbar is-light" role="navigation" aria-label="main navigation">
|
<nav class="navbar is-light" role="navigation" aria-label="main navigation">
|
||||||
<div class="navbar-brand">
|
<div class="navbar-brand">
|
||||||
<a class="navbar-item" href="#">
|
<NuxtLink to="/" class="navbar-item" onclick="switchOffMenu()">
|
||||||
<div class="logo">
|
<div class="logo">
|
||||||
<h2 class="subtitle">
|
<h2 class="subtitle">
|
||||||
<NuxtLink to="/" class="navbar-item" onclick="switchOffMenu()">Tomasz Półgrabia
|
Tomasz Półgrabia
|
||||||
</NuxtLink>
|
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</NuxtLink>
|
||||||
|
|
||||||
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
|
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
|
||||||
data-target="navbarBasicExample">
|
data-target="navbarBasicExample">
|
||||||
|
@ -61,17 +60,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
|
||||||
name: 'Navigation',
|
|
||||||
created() {
|
|
||||||
console.log(`Process ${process.client} ${process.server}`);
|
|
||||||
if (process.server || window.initialized) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.toggleMenu = function () {
|
window.toggleMenu = function () {
|
||||||
document.getElementById('navbarBasicExample').classList.toggle('is-active');
|
document.getElementById('navbarBasicExample').classList.toggle('is-active');
|
||||||
document.querySelector('#app-top .navbar-burger').classList.toggle('is-active');
|
document.querySelector('#app-top .navbar-burger').classList.toggle('is-active');
|
||||||
|
@ -82,12 +71,12 @@ export default {
|
||||||
document.querySelector('#app-top .navbar-burger').classList.remove('is-active');
|
document.querySelector('#app-top .navbar-burger').classList.remove('is-active');
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
let hoverableEls =
|
let hoverableEls =
|
||||||
Array.prototype.slice.call(document.querySelectorAll('.has-dropdown'), 0);
|
Array.prototype.slice.call(document.querySelectorAll('.has-dropdown'), 0);
|
||||||
|
|
||||||
hoverableEls.forEach(el => {
|
hoverableEls.forEach(function(el) {
|
||||||
el.addEventListener('click', (event) => {
|
el.addEventListener('click', function(event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
let dropdownEl = event.target.closest('.has-dropdown');
|
let dropdownEl = event.target.closest('.has-dropdown');
|
||||||
dropdownEl.classList.toggle('is-active');
|
dropdownEl.classList.toggle('is-active');
|
||||||
|
@ -96,14 +85,17 @@ export default {
|
||||||
|
|
||||||
let navbarBurger = document.querySelector('#app-top .navbar-burger');
|
let navbarBurger = document.querySelector('#app-top .navbar-burger');
|
||||||
if (navbarBurger) {
|
if (navbarBurger) {
|
||||||
navbarBurger.addEventListener('click', () => {
|
navbarBurger.addEventListener('click', function() {
|
||||||
window.toggleMenu();
|
window.toggleMenu();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
</script>
|
||||||
window.initialized = true;
|
</div>
|
||||||
}
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'Navigation',
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default {
|
||||||
let postRoutes = listOfPosts
|
let postRoutes = listOfPosts
|
||||||
.map(it => it.slug)
|
.map(it => it.slug)
|
||||||
.map((slug) => {
|
.map((slug) => {
|
||||||
return '/post/' + slug;
|
return '/blog/post/' + slug;
|
||||||
});
|
});
|
||||||
|
|
||||||
return postRoutes;
|
return postRoutes;
|
||||||
|
@ -24,7 +24,7 @@ export default {
|
||||||
|
|
||||||
// Global page headers: https://go.nuxtjs.dev/config-head
|
// Global page headers: https://go.nuxtjs.dev/config-head
|
||||||
head: {
|
head: {
|
||||||
title: 'nuxt_demo1',
|
title: 'Tomasz Półgrabia\'s BLog',
|
||||||
htmlAttrs: {
|
htmlAttrs: {
|
||||||
lang: 'en'
|
lang: 'en'
|
||||||
},
|
},
|
||||||
|
@ -60,6 +60,11 @@ export default {
|
||||||
config.node = {
|
config.node = {
|
||||||
fs: 'empty'
|
fs: 'empty'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// disable for production
|
||||||
|
config.devtool = 'source-map';
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
ssr: true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue