diff --git a/apps/web/nuxt.config.ts b/apps/web/nuxt.config.ts index 852dc23..fc55836 100644 --- a/apps/web/nuxt.config.ts +++ b/apps/web/nuxt.config.ts @@ -45,6 +45,7 @@ export default defineNuxtConfig({ alias: { '@core': core, '@shared': shared, + '@ui': ui, }, imports: { diff --git a/apps/web/src/App.vue b/apps/web/src/App.vue index 9045049..114ee8c 100644 --- a/apps/web/src/App.vue +++ b/apps/web/src/App.vue @@ -62,7 +62,9 @@ onNuxtReady(async () => { diff --git a/packages/ui/src/MainImage.vue b/packages/ui/src/MainImage.vue index e0db2a0..da6655c 100644 --- a/packages/ui/src/MainImage.vue +++ b/packages/ui/src/MainImage.vue @@ -2,6 +2,8 @@ import { useStorage } from '@vueuse/core' import { ImgPlaceholder } from '@core/constants' +import type { ImageProps } from 'naive-ui' + const props = withDefaults(defineProps<{ src: string alt?: string @@ -10,10 +12,12 @@ const props = withDefaults(defineProps<{ minHeight?: string | number fit?: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down' lazy?: boolean -}>(), { + preview?: boolean +} >(), { fit: 'contain', alt: 'image', lazy: true, + preview: true, }) const realSrc = ref(props.src) @@ -64,6 +68,7 @@ onUnmounted(() => { minHeight, }, }" + :preview-disabled="!preview" /> diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts new file mode 100644 index 0000000..a96e5b3 --- /dev/null +++ b/packages/ui/src/index.ts @@ -0,0 +1,5 @@ +import PostItem from './post/Item.vue' + +export { + PostItem, +} diff --git a/packages/ui/src/post/Profile.vue b/packages/ui/src/post/Profile.vue index 68b0c43..87759d1 100644 --- a/packages/ui/src/post/Profile.vue +++ b/packages/ui/src/post/Profile.vue @@ -9,7 +9,7 @@ const props = defineProps<{ const publicStore = usePublicStore() -const user = toRef(props.user || inject(KeyUser)!) +const user = toRef(props.user || inject(KeyUser) || publicStore.curUser!) const avatar = computed(() => { const url = user.value.avatar