spa_router.js:106 Uncaught TypeError: Cannot read property 'isActive' of undefined
See original GitHub issueactive class not working
<header>
<a href="/" class="logo"><img src="/logo.svg" alt="META_TITLE" border="0" /></a>
<section>
<p>META_DESCRIPTION</p>
<nav>
<a href="/news" class:active={routeIsActive('news')}>News</a>
<a href="/social" class:active={routeIsActive('social')}>Social</a>
<a href="/videos" class:active={routeIsActive('videos')}>Videos</a>
<a href="/blogs" class:active={routeIsActive('blogs')}>Blogs</a>
<a href="/podcasts" class:active={routeIsActive('podcasts')}>Podcasts</a>
<a href="/supplies" class:active={routeIsActive('supplies')}>Supplies</a>
<a href="/links" class:active={routeIsActive('links')}>Links</a>
</nav>
</section>
</header>
<script>
import { routeIsActive } from 'svelte-router-spa'
export let currentRoute = {};
// import { link, push } from 'svelte-spa-router'
// import active from 'svelte-spa-router/active'
</script>
<style>
header {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
position: fixed;
top: 0;
right: 0;
left: 0;
background-color: #fff;
box-shadow: 0px 3px 40px rgba(0, 0, 0, 0.12);
z-index: 2;
padding: 0;
}
header section {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;
}
header .logo {
padding: 0;
margin-right: 3rem;
}
header p {
margin: 1rem;
}
header img {
height: 8rem;
}
nav {
display: flex;
justify-content: flex-start;
align-items: flex-start;
flex-direction: column;
flex-wrap: nowrap;
list-style-type: none;
width: 100vw;
overflow-y: auto;
max-height: 13rem;
}
nav a {
display: block;
padding: 1rem;
border: 1px solid transparent;
color: #212121;
font-weight: 400;
text-decoration: none;
}
:global(nav a.active) {
color: var(--link-color) !important;
font-weight: 700 !important;
}
@media all and (orientation: landscape) {
header {
height: auto;
flex-direction: row;
padding: 0 11rem;
align-items: flex-start;
}
nav {
flex-direction: row;
justify-content: flex-start;
}
:global(nav a.active) {
border-bottom: 2px solid var(--active-color) !important;
}
}
</style>
<script>
import { Router } from 'svelte-router-spa'
import routes from './routes';
import Topnav from './components/Topnav.svelte';
import Footer from './components/Footer.svelte';
export let currentRoute = {};
</script>
<main>
<Topnav {currentRoute} />
<div id="body">
<Router {routes} options={ {gaPageviews: true} } />
</div>
<Footer />
</main>
<style>
main {
display: flex;
justify-content: center;
align-items: flex-start;
flex-direction: column;
}
#body {
padding: 31rem 1rem 1rem;
max-width: 100vw;
margin: 0 auto;
overflow-y: auto;
}
@media all and (orientation: landscape) {
#body {
padding: 1rem;
margin-top: 11rem;
max-width: none;
}
}
</style>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot read properties of undefined ...
I am creating an ecommerce with react. I'm trying to create a function who shows the product details. But I do not know...
Read more >Cannot read property 'get' of undefined
Hello everyone! I created a purchases controller to take data from user input, but I have an error; routes/purchases.js: import Route from ...
Read more >svelte-router
Then I tried converting this example project from svelte-spa-router to ... spa_router.js:106 Uncaught TypeError: Cannot read property 'isActive' of ...
Read more >Error: Cannot read property '_display' of undefined
Hi, I am getting the below error "Uncaught TypeError: Cannot read property '_display' of undefined" when I try to executes the SAPUI5 ...
Read more >Cannot read properties of undefined' - JavaScript Debugging
How To Fix ' Uncaught TypeError : Cannot read properties of undefined ' - JavaScript Debugging. Watch later. Share. Copy link.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m having the same issue.
Any update or method of fixing this issue?