Skip to content

Commit

Permalink
fix: 补充文件分享和相关逻辑优化
Browse files Browse the repository at this point in the history
  • Loading branch information
hsingyin committed Nov 1, 2024
1 parent e934e2c commit 1a73384
Show file tree
Hide file tree
Showing 7 changed files with 353 additions and 146 deletions.
21 changes: 20 additions & 1 deletion src/components/FileListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
style="position: relative"
:style="{ top: appearanceSetting.isSimpleMode ? '8px' : '0' }"
>
<button
v-if="shareBtnVisible"
class="share-sub-link"
@click.stop="onClickShareLink"
>
<font-awesome-icon icon="fa-solid fa-share-nodes" />
</button>
<button class="copy-sub-link" @click.stop="onClickCopyLink">
<font-awesome-icon icon="fa-solid fa-clone" />
</button>
Expand Down Expand Up @@ -190,11 +197,13 @@
import { useI18n } from 'vue-i18n';
import { useRouter, useRoute } from 'vue-router';
import { useHostAPI } from '@/hooks/useHostAPI';
import { useBackend } from "@/hooks/useBackend";
const { copy, isSupported } = useClipboard();
const { toClipboard: copyFallback } = useV3Clipboard();
const { t } = useI18n();
const { env } = useBackend();
const props = defineProps<{
type: 'sub' | 'collection' | 'file';
Expand Down Expand Up @@ -374,7 +383,17 @@
const { showNotify } = useAppNotifyStore();
const { currentUrl: host } = useHostAPI();
const emit = defineEmits(["share"]);
const shareBtnVisible = computed(() => {
return env.value?.feature?.share;
});
const onClickShareLink = async () => {
console.log('props', props)
const type = props.type;
const data = props.file;
emit("share", data, type);
};
const onClickCopyLink = async () => {
const path = `/api/file/${encodeURIComponent(name)}`;
const url = `${host.value}${path}`;
Expand Down Expand Up @@ -441,7 +460,7 @@
font-size: 16px;
color: var(--primary-text-color);
}
.share-sub-link,
.copy-sub-link,
.refresh-sub-flow {
background-color: transparent;
Expand Down
Loading

0 comments on commit 1a73384

Please sign in to comment.