Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with layout & auth property #14

Closed
naveensky opened this issue Jun 6, 2018 · 4 comments
Closed

Issue with layout & auth property #14

naveensky opened this issue Jun 6, 2018 · 4 comments

Comments

@naveensky
Copy link

naveensky commented Jun 6, 2018

I am trying to use nuxt-property-decorator but I am finding it not working with layout & auth properties for nuxt.js and auth.nuxt.js.

I am trying to set layout = 'empty' and expect the component to use empty layout. It instead picks the default layout. Same is the issue with auth = false when using nuxt's auth module. The component should ideally be skipped from auth routes but it doesn't work that way.

I would like to understand if I am missing any class/property attribute to use to configure the component as required.

More information for auth at https://auth.nuxtjs.org/middleware.html and custom layout is available at https://nuxtjs.org/guide/views#layouts

@Try-Parser
Copy link

on layout you must declare it as a function or methods like

layout () { return "layout name" }

@husayt
Copy link
Collaborator

husayt commented Dec 4, 2018

Seems this can be closed now.

@husayt husayt closed this as completed Dec 4, 2018
@oppianmatt
Copy link

is this fixed because that doesn't work at all

image

https://codesandbox.io/s/py6rwml0jq?fontsize=14&module=%2Fpages%2Ftwo.vue

@IlyaSemenov
Copy link

FWIW, I'm augmenting the component options with:

// Nuxt.js component options
declare module 'vue/types/options' {
	interface ComponentOptions<V extends Vue> {
		layout?: string
	}
}

and then:

<script lang="ts">
import { Vue, Component } from 'nuxt-property-decorator'

@Component({
	layout: 'simple',
})
export default class UserPage extends Vue {

Same for other Nuxt component options like fetch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants