forked from FoundKeyGang/FoundKey
client: fix lints in photos.vue
This commit is contained in:
parent
7e462fb1b4
commit
8f775defaf
1 changed files with 17 additions and 12 deletions
|
@ -16,8 +16,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onUnmounted, reactive, ref } from 'vue';
|
import { onUnmounted } from 'vue';
|
||||||
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
|
import { DriveFile } from 'foundkey-js/built/entities';
|
||||||
|
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
|
||||||
import { GetFormResultType } from '@/scripts/form';
|
import { GetFormResultType } from '@/scripts/form';
|
||||||
import { stream } from '@/stream';
|
import { stream } from '@/stream';
|
||||||
import { getStaticImageUrl } from '@/scripts/get-static-image-url';
|
import { getStaticImageUrl } from '@/scripts/get-static-image-url';
|
||||||
|
@ -44,8 +45,12 @@ type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
||||||
// 現時点ではvueの制限によりimportしたtypeをジェネリックに渡せない
|
// 現時点ではvueの制限によりimportしたtypeをジェネリックに渡せない
|
||||||
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
||||||
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
||||||
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
|
const props = defineProps<{
|
||||||
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
|
widget?: Widget<WidgetProps>;
|
||||||
|
}>();
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(ev: 'updateProps', widgetProps: WidgetProps);
|
||||||
|
}>();
|
||||||
|
|
||||||
const { widgetProps, configure } = useWidgetPropsManager(name,
|
const { widgetProps, configure } = useWidgetPropsManager(name,
|
||||||
widgetPropsDef,
|
widgetPropsDef,
|
||||||
|
@ -54,17 +59,17 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
|
||||||
);
|
);
|
||||||
|
|
||||||
const connection = stream.useChannel('main');
|
const connection = stream.useChannel('main');
|
||||||
const images = ref([]);
|
let images: DriveFile[] = $ref([]);
|
||||||
const fetching = ref(true);
|
let fetching = $ref(false);
|
||||||
|
|
||||||
const onDriveFileCreated = (file) => {
|
const onDriveFileCreated = (file: DriveFile): void => {
|
||||||
if (/^image\/.+$/.test(file.type)) {
|
if (/^image\/.+$/.test(file.type)) {
|
||||||
images.value.unshift(file);
|
images.unshift(file);
|
||||||
if (images.value.length > 9) images.value.pop();
|
if (images.length > 9) images.pop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const thumbnail = (image: any): string => {
|
const thumbnail = (image: DriveFile): string => {
|
||||||
return defaultStore.state.disableShowingAnimatedImages
|
return defaultStore.state.disableShowingAnimatedImages
|
||||||
? getStaticImageUrl(image.thumbnailUrl)
|
? getStaticImageUrl(image.thumbnailUrl)
|
||||||
: image.thumbnailUrl;
|
: image.thumbnailUrl;
|
||||||
|
@ -74,8 +79,8 @@ os.api('drive/stream', {
|
||||||
type: 'image/*',
|
type: 'image/*',
|
||||||
limit: 9,
|
limit: 9,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
images.value = res;
|
images = res;
|
||||||
fetching.value = false;
|
fetching = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
connection.on('driveFileCreated', onDriveFileCreated);
|
connection.on('driveFileCreated', onDriveFileCreated);
|
||||||
|
|
Loading…
Reference in a new issue