Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
update github card refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Aug 6, 2023
1 parent 492a05d commit dbf9f19
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/assets/script/card/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ type GithubRepo = {

export const data = ref<GithubRepo[]>([]);

let loading = false;
export function update() {
if (loading) return;
loading = true;
axios.get("/github")
.then((res) => {
data.value = res.data.data;
loading = false;
})
.catch((e) => {
console.debug(e);
loading = false;
})
}
9 changes: 8 additions & 1 deletion src/components/cards/GithubCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ update();
<div class="github-top">
<span class="github-name">GitHub</span>
<span style="flex-grow: 1" />
<span class="github-explore">Explore</span>
<span class="github-explore" @click="update">Explore</span>
</div>
<div class="github-content">
<template v-for="(repo, idx) in data" :key="idx">
Expand Down Expand Up @@ -145,6 +145,13 @@ update();
background: rgba(56, 140, 255, 0.8);
padding: 2px 6px;
border-radius: 4px;
cursor: pointer;
user-select: none;
transition: .3s;
}
.github-explore:hover {
background: rgba(56, 140, 255, 1);
}
.github-content {
Expand Down

1 comment on commit dbf9f19

@vercel
Copy link

@vercel vercel bot commented on dbf9f19 Aug 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.