How to use the nuxt-property-decorator.Getter function in nuxt-property-decorator

To help you get started, we’ve selected a few nuxt-property-decorator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuefront / vuefront / pages / store / product / _id.vue View on Github external
import {Vue, Component, Getter} from 'nuxt-property-decorator'
import productGetGql from '~/types/graphql/store/product/get.graphql'
import {Product} from "~/types";

@Component({
  head() {
    return {
      title: (this as any).product.name,
      meta: [
        { hid: 'description', name: 'description', content: (this as any).product.shortDescription }
      ]
    }
  }
})
export default class extends Vue {
  @Getter('store/product/get') product!: Product

  async fetch({store, app, params}) {
    await store.dispatch('apollo/query', {
      query: productGetGql,
      variables: {id: Number(params.id), limit: 3, productLimit: 4}
    })
    const {product} = store.getters['apollo/get']
    store.commit('store/product/setProduct', product)
  }
}
github vuefront / vuefront / pages / blog / category / _id.vue View on Github external
import {Pagination, Post, CategoryBlog} from "~/types";

@Component({
  head() {
    return {
      title: (this as any).category.name,
      meta: [
        {hid: 'description', name: 'description', content: (this as any).category.description}
      ]
    }
  },
  watchQuery: true
})
export default class extends Vue {
  @Getter('blog/post/list') posts!: Pagination
  @Getter('blog/category/get') category!: CategoryBlog

  async handleChangePage(page) {
    this.$router.push({
      path: '/blog/category/'+this.$route.params.id,
      query: {page}
    })
  }

  async asyncData({store, route, app, params}) {
    const page = route.query.page ? Number(route.query.page) : 1

    await store.dispatch('apollo/query', {
      query: categoryPageGql,
      variables: {page, size: 12, categoryId: Number(params.id)}
    })
github vuefront / vuefront / pages / store / category / _id.vue View on Github external
import categoryPageGql from '~/types/graphql/store/category/page.graphql'
import {Pagination, Product, Category, SizeItem, SortItem} from "~/types";

@Component({
  head() {
    return {
      title: (this as any).category.name,
      meta: [
        {hid: 'description', name: 'description', content: (this as any).category.description}
      ]
    }
  },
  watchQuery: true
})
export default class extends Vue {
  @Getter('store/category/get') category!: Category
  @Getter('store/product/list') products!: Pagination

  async handleChangePage(page) {
    this.$router.push({
      path: '/store/category/' + this.$route.params.id,
      query: {page}
    })
  }

  async asyncData({store, route, params: {id}}) {
    const page = route.query.page ? Number(route.query.page) : 1
    const size = route.query.size ? Number(route.query.size) : 15
    const sort = route.query.sort ? route.query.sort : 'id'
    const order = route.query.order ? route.query.order : 'ASC'
    await store.dispatch('apollo/query', {
      query: categoryPageGql,
github vuefront / vuefront / pages / store / category / _id.vue View on Github external
import {Pagination, Product, Category, SizeItem, SortItem} from "~/types";

@Component({
  head() {
    return {
      title: (this as any).category.name,
      meta: [
        {hid: 'description', name: 'description', content: (this as any).category.description}
      ]
    }
  },
  watchQuery: true
})
export default class extends Vue {
  @Getter('store/category/get') category!: Category
  @Getter('store/product/list') products!: Pagination

  async handleChangePage(page) {
    this.$router.push({
      path: '/store/category/' + this.$route.params.id,
      query: {page}
    })
  }

  async asyncData({store, route, params: {id}}) {
    const page = route.query.page ? Number(route.query.page) : 1
    const size = route.query.size ? Number(route.query.size) : 15
    const sort = route.query.sort ? route.query.sort : 'id'
    const order = route.query.order ? route.query.order : 'ASC'
    await store.dispatch('apollo/query', {
      query: categoryPageGql,
      variables: {page, size, categoryId: Number(id), sort, order}
github vuefront / vuefront / pages / blog / category / _id.vue View on Github external
import categoryPageGql from '~/types/graphql/blog/category/page.graphql'
import {Pagination, Post, CategoryBlog} from "~/types";

@Component({
  head() {
    return {
      title: (this as any).category.name,
      meta: [
        {hid: 'description', name: 'description', content: (this as any).category.description}
      ]
    }
  },
  watchQuery: true
})
export default class extends Vue {
  @Getter('blog/post/list') posts!: Pagination
  @Getter('blog/category/get') category!: CategoryBlog

  async handleChangePage(page) {
    this.$router.push({
      path: '/blog/category/'+this.$route.params.id,
      query: {page}
    })
  }

  async asyncData({store, route, app, params}) {
    const page = route.query.page ? Number(route.query.page) : 1

    await store.dispatch('apollo/query', {
      query: categoryPageGql,
      variables: {page, size: 12, categoryId: Number(params.id)}
    })