Skip to content

Commit

Permalink
feat: copy to clipboard when clicking scores
Browse files Browse the repository at this point in the history
  • Loading branch information
Xecades committed Feb 6, 2024
1 parent 2d276de commit bbd411a
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 10 deletions.
42 changes: 38 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dangerouslyUploadLocal": "node --env-file=.env.local ./tools/uploadLocal.js"
},
"dependencies": {
"clipboard": "^2.0.11",
"element-plus": "^2.5.3",
"leancloud-storage": "^2.5.4",
"markdown-it": "^14.0.0",
Expand Down
12 changes: 6 additions & 6 deletions src/components/RemarkComp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import markdownit from "markdown-it";
import { onMounted, ref } from "vue";
const $ = defineProps({ data: Object });
const md = markdownit({
html: true,
});
const md = markdownit({ html: true });
const parsed = ref("");
const setHash = () => {
const copyRef = () => {
navigator.clipboard.writeText(`https://tsk.xecades.xyz/#${$.data.objectId}`);
location.hash = `#${$.data.objectId}`;
};
Expand All @@ -22,8 +21,9 @@ onMounted(() => {
<el-card shadow="hover" :id="data.objectId">
<template #header>
<el-text size="large" type="info" class="info">
<el-text size="large" type="primary" style="cursor: pointer;" @click="setHash">{{ data.score }}
分</el-text>
<el-text size="large" type="primary" style="cursor: pointer;" @click="copyRef">
{{ data.score }} 分
</el-text>
· {{ data.name || "匿名" }} · {{ data.grade }} · {{ data.course }}
</el-text>
</template>
Expand Down

0 comments on commit bbd411a

Please sign in to comment.