Obaid
Obaid

Reputation: 426

Nuxt switch Layout by button

Is it possible to switch the layout dynamically with a button?

I've tried different methods, but none of them worked.

data(){
   return {
     layoutName: 'default'
   }
},
layout: this.layoutName

and I tried to use Vuex too

layout: this.$store.state.layoutName

Upvotes: 2

Views: 2041

Answers (1)

Obaid
Obaid

Reputation: 426

I figured out. In Nuxt you can change the layout programmatically by using this method:

this.$nuxt.setLayout('Layout_Name')

Upvotes: 2

Related Questions