<template lang="pug">
.inner-wrapper
<Breadcrumbs :labels="labels"/>
main.main#content
Article
template(v-slot:title)
h1.article__title {{ post.title }}
template(v-slot:toc v-if="post.toc")
Toc(:data="post.toc")
template(v-slot:text)
.article__text
.container(v-html="post.text")
</template>
<script>
import Breadcrumbs from '@/components/sections/breadcrumbs';
import Article from '@/components/sections/article';
import Table from '@/components/table';
import Toc from '@/components/toc';
export default {
validate({params}) {
return Boolean(params.id);
},
data() {
return {
post: {},
};
},
components: {
Breadcrumbs,
Article,
Table,
Toc,
Gallery: () => import('vue-easy-lightbox'),
},
computed: {
labels() {
return {
last: this.post.title,
};
},
},
async created() {
const query = `
query Articles($id: ID!) {
article(id: $id) {
title
descr
keywords
slug
text
}
}
`;
const responce = await this.$axios.$post(URL, {
query,
variables: {
id: this.$route.params.id,
},
headers: {
'content-type': 'application/json',
},
});
this.post = responce.data.article;
},
};