feat: add ListTag Component.

This commit is contained in:
kms
2022-11-27 16:14:33 +09:00
parent 534f62c4e8
commit 021c8d7b74
3 changed files with 39 additions and 13 deletions

View File

@@ -61,7 +61,7 @@ export default defineComponent({
}
onMounted(() => {
axios.get(url + "/api/articles", )
axios.get(url + "/api/articles")
.then(response => {
articles.article = response.data.articles;
articles.articlesCount = response.data.articlesCount;

View File

@@ -0,0 +1,34 @@
<template>
<div class="tag-list">
<a href="javascript:(0)" class="tag-pill tag-default"
v-for = "tag in listTags.tags">{{tag}}</a>
</div>
</template>
<script lang="ts">
import {onMounted, defineComponent, reactive} from "vue";
import axios from "axios";
export default defineComponent({
name: "TagList",
setup(){
const url = import.meta.env.VITE_BASE_URL;
const listTags = reactive({
tags: new Array()
})
onMounted(() => {
axios.get(url + "/api/tags")
.then(response => {
listTags.tags = response.data.tags
});
})
return { listTags }
}
})
</script>
<style scoped>
</style>

View File

@@ -52,17 +52,7 @@
<div class="col-md-3">
<div class="sidebar">
<p>Popular Tags</p>
<div class="tag-list">
<a href="" class="tag-pill tag-default">programming</a>
<a href="" class="tag-pill tag-default">javascript</a>
<a href="" class="tag-pill tag-default">emberjs</a>
<a href="" class="tag-pill tag-default">angularjs</a>
<a href="" class="tag-pill tag-default">react</a>
<a href="" class="tag-pill tag-default">mean</a>
<a href="" class="tag-pill tag-default">node</a>
<a href="" class="tag-pill tag-default">rails</a>
</div>
<tag-lists></tag-lists>
</div>
</div>
@@ -76,13 +66,15 @@
import articleList from '@/components/ArticleListFeed.vue'
import articleListGlobal from "@/components/ArticleListGlobal.vue";
import tagLists from "@/components/TagList.vue";
import {ref} from "vue";
import {useStore} from "vuex";
export default {
name: "TheHome",
components: {
'article-list': articleList,
'article-list-global': articleListGlobal
'article-list-global': articleListGlobal,
'tag-lists': tagLists,
},
setup(){
const isLoading = ref(true);