A
A
Adelina Turcan2019-02-21 01:49:48
JavaScript
Adelina Turcan, 2019-02-21 01:49:48

How to make custom sidebar for multiple pages?

The situation is like this:

  • default templatelayouts/default.vue
  • left sidebar which is present on all pages
  • right sidebar, which should only be a few pages

In store/index.jsI store the switch, if state.sidebar.right === truethen in I layouts/defaultshow the button for opening the right sidebar.
Now the problem is that when you go to the page in which there should be a sidebar, load the necessary components in it and in them data from API.
And another question, where do you need to store <v-navigation-drawer>it so that it opens when you click on the button with layout/default? Obligatory in layout/default? Tried storing it in the page component ( pages/cat/index.vue) but doesn't work. Probably you need to keep its state also in the store, do I understand correctly?
<nuxt-child>also tried to use but loaded the content that is in<nuxt>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Malkov, 2019-02-21
@MalkovVladimir73

Use Vue Router . Load data in routing hooks. Describe the different paths in accordance with which certain components will be loaded.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question