feat: add ListTag Component.
This commit is contained in:
@@ -61,7 +61,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
axios.get(url + "/api/articles", )
|
axios.get(url + "/api/articles")
|
||||||
.then(response => {
|
.then(response => {
|
||||||
articles.article = response.data.articles;
|
articles.article = response.data.articles;
|
||||||
articles.articlesCount = response.data.articlesCount;
|
articles.articlesCount = response.data.articlesCount;
|
||||||
|
|||||||
34
src/vite-frontend/src/components/TagList.vue
Normal file
34
src/vite-frontend/src/components/TagList.vue
Normal 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>
|
||||||
@@ -52,17 +52,7 @@
|
|||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<p>Popular Tags</p>
|
<p>Popular Tags</p>
|
||||||
|
<tag-lists></tag-lists>
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -76,13 +66,15 @@
|
|||||||
|
|
||||||
import articleList from '@/components/ArticleListFeed.vue'
|
import articleList from '@/components/ArticleListFeed.vue'
|
||||||
import articleListGlobal from "@/components/ArticleListGlobal.vue";
|
import articleListGlobal from "@/components/ArticleListGlobal.vue";
|
||||||
|
import tagLists from "@/components/TagList.vue";
|
||||||
import {ref} from "vue";
|
import {ref} from "vue";
|
||||||
import {useStore} from "vuex";
|
import {useStore} from "vuex";
|
||||||
export default {
|
export default {
|
||||||
name: "TheHome",
|
name: "TheHome",
|
||||||
components: {
|
components: {
|
||||||
'article-list': articleList,
|
'article-list': articleList,
|
||||||
'article-list-global': articleListGlobal
|
'article-list-global': articleListGlobal,
|
||||||
|
'tag-lists': tagLists,
|
||||||
},
|
},
|
||||||
setup(){
|
setup(){
|
||||||
const isLoading = ref(true);
|
const isLoading = ref(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user