I tried to create a navbar like this in vue-nuxt
<template>
<div class="navbar-padding">
<nav class="navbar navbar-expand-lg navbar-light">
<img
:src="navImage"
width="60"
height="60"
class="d-inline-block align-top customo-logo"
alt="company-logo"
/>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li
v-for="(el, index) in links"
:key="'item_' + index"
class="navbar-li"
>
<a class="navbar-text-right" href="/"></a>
</li>
</ul>
</div>
</nav>
</div>
</template>
This does show the navbar as expected but on mobile, when I click on it, the hamburger does not toggle the menu
This is my nuxt config file
module.exports = {
mode: 'universal',
/*
** Headers of the page
*/
head: {
title: process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: "stylesheet", type: "text/css", href: "https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" }
]
},
/*
** Customize the progress-bar color
*/
loading: { color: '#fff' },
/*
** Global CSS
*/
css: [
// SCSS file in the project
'@/assets/css/common.scss',
'@/assets/css/button.scss',
'@/assets/css/navbar.scss',
],
script: [
{ src: 'https://code.jquery.com/jquery-3.3.1.slim.min.js' },
{ src: 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js' },
{ src: 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js' }
],
/*
** Plugins to load before mounting the App
*/
plugins: [
],
/*
** Nuxt.js dev-modules
*/
buildModules: [
],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://bootstrap-vue.js.org
'bootstrap-vue/nuxt',
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
'@nuxtjs/pwa',
// Doc: https://github.com/nuxt-community/dotenv-module
'@nuxtjs/dotenv',
'nuxt-fontawesome'
],
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {
},
/*
** Build configuration
*/
build: {
/*
** You can extend webpack config here
*/
extend (config, ctx) {
}
}
}
Any idea what I could be doing wrong here?
from Hamburger menu not toggling in vue-nuxt project
No comments:
Post a Comment