nuxt-community / nuxt-property-decorator

Property decorators for Nuxt (base on vue-property-decorator)
https://github.com/kaorun343/vue-property-decorator
MIT License
399 stars 34 forks source link

Issue with layout & auth property #14

Closed naveensky closed 5 years ago

naveensky commented 6 years ago

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 commented 6 years ago

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

layout () { return "layout name" }

husayt commented 5 years ago

Seems this can be closed now.

oppianmatt commented 5 years ago

is this fixed because that doesn't work at all

image

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

IlyaSemenov commented 5 years ago

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.