An easy way to disable all items within the botnav section of Vuetify

Is there a way to efficiently manage the activation and deactivation of items in a Vuetify botnav based on different router paths?

I attempted to manipulate the active.sync property to -1 when I need to deactivate a tab. However, this approach only works if no item has been activated previously. If an item is activated and then the active.sync is set to -1 again, it automatically reactivates the first item:

 <v-bottom-nav
  :active.sync="bottomNav"
  :value="true"
  shift
  absolute
>
  // Buttons for different items
</v-bottom-nav>

In the script section:

 watch:{
 $route:function(to, from){
 switch(to.path){
  // Cases to handle different paths
}
}
}

One workaround I found effective was to include a hidden dummy item in the botnav with its visibility set to false. By activating this hidden item, all other visible items get deactivated as intended:

Dummy item example:

<v-bottom-nav
 :active.sync="bottomNav"
 //other configurations
 >
//visible items
<v-btn v-show="0" value="inactivate"></v-btn>
</v-bottom-nav>

To deactivate all items programmatically, the following code snippet can be used:

this.bottomNav = "inactivate"

This method does work effectively, but it feels somewhat like a hack. Is there a more elegant or formal solution to achieve the same result?

Answer №1

The default value for active.sync is not specified, so one approach is to utilize the void keyword for resetting:

this.bottomNav = void(0)

[ https://jsfiddle.net/e8a67qtp/ ]

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to retrieve the data from promises after they have been resolved?

I'm struggling to retrieve the values from getPeople(0,4). function getPeople(start, end) { const peopleArray = []; for (let i = start; i <= end; i++) { peopleArray.push( axios.get(`https://www.testsite.net/api/test/workers/ ...

Transitioning from Chrome's USB App API to the Web USB API

My current challenge involves migrating my API from a Chrome App to a Progressive Web Application due to the deprecation of the platform. I need to retain USB support in my web platform application, and someone recommended utilizing the Web USB API. Howev ...

Adding new elements to a list with Jquery, seamlessly integrating them without the need to

I am facing a bit of a roadblock in figuring out how to achieve this, mainly due to my limited understanding of JavaScript. The code that I have been looking at is as follows: http://jsfiddle.net/spadez/VrGau/ What I am attempting to accomplish is allowi ...

How do server side cookies and javascript cookies interact with each other?

Can you explain the connection between the cookies generated by the Cookie Class in Servlet and document.cookie in JavaScript? ...

Pass JS POST request data as body parameters

Is there a way to send a parameter as the post body to an API while also including the required Authorization header with the API key? How can I include a post body request with data set as "server_id: 12345"? What is the method to display the JSON res ...

The combination of Inline CSS and Bootstrap classes does not seem to be functioning properly

I'm new to web design and currently working on a website project. My concept involves hiding the #login-box when the user clicks on the login button, and displaying another element (.dashboard) in its place. Initially, I set the .dashboard class to ha ...

Whenever I try to download express using npm install, I encounter a checksum

I currently have node version 0.10.30 and npm version 1.4.21 installed on my system. When I run the following command: npm install express I encounter the following error: Error: shasum check failed for /tmp/npm-4273-g1Rb0gCE/registry.npmjs.org/express/ ...

Implementing an autosuggest feature for the TagsInput component

When developing my website, I utilized JavaScript, the React framework, and a library called mui. One of the user input features on my site is powered by TagsInput, allowing users to input data, press enter, view the tag, and optionally delete it. Unlike ...

Firefoxx unable to communicate with server through ajax requests

My dilemma involves transmitting data to my server using the json data type with ajax. Oddly enough, in Firefox the server fails to receive any data at all, while in Chrome and IE the data is successfully transmitted and displayed on the server console. H ...

Build an intricate nested array structure using the properties of an object

My data object is structured like this: "parameters": { "firstName": "Alexa", "lastName": "Simpson", "city": "London" } The task at hand involves implementing the followin ...

By executing array1.splice(1,1), I am deleting elements from array2 that was generated by copying array1 with array1.slice(0)

I was working with JSON data and converted it into an array of objects. Then, I assigned that array to another array using the .slice(0) method. However, I encountered an issue where when I tried to remove an element from the assigned array, it also remov ...

Please provide values in the input box, with each value separated by

I attempted the following code: success: function (result) { for (var i = 0; i < result.d.length; i++) { var emails = new Array(); emails = result.d[i].Emailid; alert(emails); $("#EmailCC").val(emails); ...

BookshelfJS: Establishing a One-to-One Relationship

Within my database, I am working with two tables - User and Address. The User table consists of the following two methods: shippingAddress: function() { var Address = require(appRoot + '/config/db').model('Address'); return thi ...

Tips for formatting the body of a post request

After sending a data from a nodejs server Using POST REQUEST { "id": "285104348274884628", "username": "TEST USERNAME", "apiKey": "5WA8G5LUYPJB8RII64RE443EFTTY-PY" } The Post Code In ...

Add the current date plus 48 hours to the content on a webpage (JavaScript maybe?)

Hello there, I am currently in the process of setting up a small online store for a farm using Squarespace. One thing I would like to implement is specifying that items will be available for pickup two days after they are purchased online, instead of imme ...

Activate a function in Jquery after iterating through all elements in a JSON file

Below is the code I am using to ping a list of computers with Jquery and asp.net. function ping() { $('#progress').css("display", ""); $('.comp').each(function () { var $computer = $ ...

Incorporate a unique identifier $id within the ajax request

Whenever I make changes to my product, I would like the categories to show up in a dropdown menu. Currently, it only displays: -- Select your category -- For instance, if my $current_category_id = 2, I want the dropdown to show the relevant categories. ...

Is it possible to link an HTML select element to a changing array in JavaScript?

Let's say I have an empty HTML select element. <select id="options"> </select> Can I link a JavaScript array to this select so that when the array is modified, the select options update accordingly? Alternatively, do I need to resort to ...

Having Difficulty with Splicing Arrays in React?

Currently working on learning React and trying to develop my own mini-app. I'm basing it very closely on the project showcased in this video tutorial. I've run into an issue with the comment deletion functionality in my app. Despite searching va ...

What could be causing the incorrect output when an else statement is included?

When I run the code provided below, I am getting a different answer depending on whether the else statement is included or not. Without the else statement, the answer is true, but with the else statement it is false. Can anyone explain why this is happen ...