[Vuejs]-Could not display / switch pages with vue-router

1๐Ÿ‘

โœ…

<template>
  <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container-fluid">
            <a class="navbar-brand" to="/home" role="button">Navbar</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
                data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
                aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                    <li class="nav-item">
                        <a class="nav-link active" role="button" to="/home">Home</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" role="button" to="/site">Site 1</a>
                    </li>    
                </ul>
            </div>
            <router-view></router-view>
        </div>
    </nav>
</template>
export default {
  name: 'App'

homeView.vue and siteView.vue will be displayed here <router-view> </router-view> when you click page link

๐Ÿ‘คblack horse

Leave a comment