1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-27 10:10:50 +03:00

Articles v 0.01

This commit is contained in:
Giyos 2018-09-16 19:45:48 +05:00
parent 326c8559d7
commit 2c57d6dcd2
3 changed files with 55 additions and 3 deletions

View File

@ -0,0 +1,23 @@
<template>
<v-container>
</v-container>
</template>
<script lang="ts">
import Vue from 'vue'
import Component from 'vue-class-component';
import { IArticle } from 'client/service/Article'
@Component
export default class Article extends Vue {
async asyncData({ store }) {
return store.dispatch('category/loadArticleList')
}
get articles() {
return this.$store.state.article.articlesList
}
}
</script>

View File

@ -3,9 +3,9 @@
<v-toolbar-side-icon></v-toolbar-side-icon>
<v-toolbar-title>Aelve Guide</v-toolbar-title>
<v-spacer></v-spacer>
<search></search>
<!-- <search></search> -->
<v-toolbar-items class="hidden-sm-and-down">
<v-btn flat>Login</v-btn>
<v-btn v-on:click="getApi" flat>Login</v-btn>
</v-toolbar-items>
</v-toolbar>
</template>
@ -14,11 +14,17 @@
import Vue from 'vue';
import Search from './Search.vue';
import Component from 'vue-class-component';
import axios from "axios";
@Component({
components: {
Search
}
})
export default class Toolbar extends Vue {}
export default class Toolbar extends Vue {
async getApi() {
const { data } = await axios.get('api');
console.log(data);
}
}
</script>

View File

@ -0,0 +1,23 @@
import axios from 'axios';
class ArticleService {
async getArticle(): Promise<IArticle[]> {
const { data } = await axios.get('api/category/sth6l9jl', {})
console.log(data);
return data;
}
}
export interface IArticle {
status: string,
group: string,
uid: string,
items: [],
title: string,
desription: string
}
const articleServiceInstance = new ArticleService();
export { articleServiceInstance as ArticleService }