feat(FriendLink.vue): 增加友情链接组件

This commit is contained in:
xiongxiaoyang
2022-05-14 17:02:15 +08:00
parent 47356f4f8f
commit f5e23d75b5
3 changed files with 54 additions and 10 deletions

View File

@@ -0,0 +1,43 @@
<template>
<div class="friend_link">
<div class="box_center cf" id="friendLink">
<span>友情链接</span>
<a
v-for="(item, index) in friendLinks"
:key="index"
target="_blank"
:href="item.linkUrl"
>{{ item.linkName }}
</a>
</div>
</div>
</template>
<script>
import { reactive, toRefs, onMounted } from "vue";
import { ElMessage, ElLoading } from "element-plus";
import { listHomeFriendLinks } from "@/api/home";
export default {
name: "FriendLink",
setup() {
const state = reactive({
friendLinks: [],
});
onMounted(async () => {
const loadingInstance = ElLoading.service({
target: "#indexNews",
text: "加载中。。。",
});
const { data } = await listHomeFriendLinks();
loadingInstance.close();
state.friendLinks = data;
});
return {
...toRefs(state),
};
},
};
</script>