mirror of
https://gitee.com/novel_dev_team/novel-front-web
synced 2026-07-20 17:54:10 +08:00
feat(FriendLink.vue): 增加友情链接组件
This commit is contained in:
43
src/components/FriendLink.vue
Normal file
43
src/components/FriendLink.vue
Normal 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>
|
||||
Reference in New Issue
Block a user