How to use v-if in Quasar framework to hide a Vuejs component on the signup page

Currently, I am utilizing the Quasar drawer feature in my application. On the signup view, I would like to hide the drawer. While my current code successfully hides the drawer, an issue arises when I reload the signup page as it briefly renders in the DOM before disappearing.

I am unsure how to resolve this issue - ideally, I would like to prevent the drawer from rendering in the DOM at all or have more control over its visibility. One approach could be to set the drawer default to false and manually render it on specific routes.

<template>
  <div>
    <q-header elevated class="bg-indigo-4">
      <q-toolbar>
        <q-toolbar-title class="flex flex-center"></q-toolbar-title>
      </q-toolbar>
    </q-header>

    <q-drawer
      v-model="drawer"
      v-if="!$route.meta.hideDrawer"
      :width="300"
      :breakpoint="400"
    >
      <q-scroll-area
        style="height: calc(100% - 150px); margin-top: 150px; border-right: 1px solid #ddd"
      >
        <drawer-navigation></drawer-navigation>
      </q-scroll-area>
      <drawer-header></drawer-header>
    </q-drawer>
  </div>
</template>

<script>
import DrawerNavigation from "@/components/navigation/DrawerNavigation";
import DrawerHeader from "@/components/navigation/DrawerHeader";
export default {
  components: {
    DrawerNavigation,
    DrawerHeader
  },
  data() {
    return {
      drawer: true
    };
  }
};
</script>

router/index.js

{
 path: "/employers/signup",
 name: "EmployersSignup",
 component: () =>
   import(/* webpackChunkName: "about" */ "../views/EmployerSignup.vue"),
 meta: { hideDrawer: true }
},

Answer №1

Experiment with creating a new variable such as isVisible: true, then insert it into the v-show of the q-panel

Additionally, set up a watcher for the condition $route.meta.showPanel and assign the value of that element to the variable isVisible

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

Determining the Clicked Button in React When Multiple Buttons are Present

Within my functional component, I have a table with rows that each contain an edit button. However, when I click on one edit button, changes are applied to all of them simultaneously. How can I identify which specific button was clicked and only apply chan ...

Accept only requests from my Chrome extension

I have successfully set up a NodeJS server with Express on DigitalOcean. My Chrome extension is able to make GET calls to the server without any issues. However, I am looking to enhance the security of the middleware below: // Add headers app.use(function ...

Having trouble with submitting an Ajax form to a MySQL database

My expertise lies in PHP and HTML, but I'm currently learning JavaScript. I'm facing a challenge with creating a form that can submit data to be inserted into MySQL without reloading the page (using AJAX). Here is the form I have: <form id=" ...

Ensure that the form is validated even when setState is not executed immediately

I am currently working on a form in React and I am facing an issue with validation. When the Submit Form button is clicked without filling in the input fields, an error should be displayed. This part is functioning correctly. However, even when the fields ...

How to transform a file into a uInt8Array using Angular

Looking to implement a feature where I can easily upload files from Angular to PostgreSQL using a Golang API. In my Angular component, I need to convert my file into a uInt8Array. I have managed to convert the array, but it seems to be encapsulated in som ...

What steps should I take to either combine my two functions in my script or ensure they are executed in a specific sequence?

I'm attempting to incorporate a script into an HTML file (based on the solution provided by "skara9" in this post) and customize it to suit my requirements. However, I'm struggling to figure out how to make it work as intended. The script consis ...

Encountering HTML content error when attempting to log in with REST API through Express on Postman

I'm currently in the process of developing a basic login API using Node.js and Express. However, I've encountered an error when testing with Postman: <!DOCTYPE html> <html lang="en"> <head> <meta charse ...

Having various ng-apps within a single parent app

Exploring angularjs for the first time and experimenting with multiple ng-apps on a single page. For example, having app2 inside app1 and app1 within rootApp. controller1 includes an $http service that retrieves id and name values and assigns them to $roo ...

The Autofocus feature in HTML5 is malfunctioning in Internet Explorer 9

I am currently working on a project for IE9, and I am having trouble with the HTML5 autofocus keyword not functioning as expected. Specifically, the autofocus feature that puts the cursor in the specified input field is not working in IE9 (and I am forced ...

Getting started with integrating Vue.js with Lumen: a step-by-step guide

After successfully creating a RESTful API using Lumen and testing it with Postman, I am now looking to develop the front end for it with Vue. What is the best approach for integrating Vue into my existing project? Should I create a separate directory for ...

The timing of the JavaScript dialog with the AJAX call is off-kilter

Encountering an issue with a JavaScript script designed to showcase a JQUERY dialog box based on a C# ViewModel. Within a repeater, there is an ASP drop-down menu displaying 'Registration Date' details. The objective is for the JavaScript dialog ...

Angular filter that replaces underscores with spaces

Looking for a solution to replace underscores with spaces in a string ...

Locate all elements in Jquery that have a custom attribute starting with a specific prefix, then extract the remaining part of the attribute name along with its corresponding value

Consider an element with a custom attribute ... data-bind="varName" ... I am searching for all elements with attributes that start with "data-bind-", then extracting the second part of the attribute name, which is unknown. In this example, it is "varNa ...

Can Highchart dynamically adjust color choices based on the quantity of data points available?

I am trying to figure out how to import a specific color palette into my column graph. I want to use different color palettes based on the number of data points in my graph - for 3 or fewer points, I want to use the top row colors, for 4 points I want to u ...

Can Firebase lists be reversed?

I have searched extensively on SO for an answer to this question, but I haven't found a solution yet. Therefore, please do not mark this as a duplicate. Currently, I am working with AngularFire in Angular 2 and Typescript. I am using FirebaseListObse ...

What is the best way to display JQuery mobile tap event information in real-time?

I am experiencing an issue in my code where the tap event is being triggered, but the array[i] value is printed as null. Whenever I click on any index, it always prints an empty string (" "). Why does it display null instead of the clicked value? I am see ...

Heapsnapshot in node.js not releasing memory due to issues with RSS

After dealing with a memory leak issue in my node application for several days, I encountered an anomaly where the rss memory was not being released even after performing a heapdump. The Node.js version being used is: $ node --version v12.16.2 Prior to ...

What is the best way to extend a class in NestJS from another class?

I've encountered an issue while attempting to extend a class service from another class service in NestJS and utilize DI to load it in a third service. The error message I'm receiving from Nest is: Error: Nest can't resolve dependencies of ...

The initial click does not trigger a Vue DOM update, but subsequent clicks do initiate the update

I developed a Vue application for a dynamic form with two buttons, and I need to indicate which button was clicked in the request. To achieve this, I update the value of a hidden input field and then submit the form using jQuery. However, when I click on t ...

There was an error in parsing JSON data because the input value is missing a property name or '}'

One challenge I am facing is converting the value from a hidden input field into a JSON object when a button is clicked. The HTML code for the hidden input field looks like: <input type="hidden" name="product-data" value="{Product: 'Premium', ...