Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
}
}
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)}
})
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,
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}
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)}
})
<style type="postcss"></style>
<style type="postcss"></style>