fix: eslint and lint fixed
This commit is contained in:
@@ -1,41 +1,40 @@
|
||||
<script setup lang='ts'>
|
||||
import {ref,onMounted} from 'vue'
|
||||
import localforage from 'localforage'
|
||||
const props=defineProps({
|
||||
import { onMounted, ref } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
imgItem: {
|
||||
type:Object,
|
||||
default:()=>({})
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
})
|
||||
const imageDbStore = localforage.createInstance({
|
||||
name: 'imgStore'
|
||||
name: 'imgStore',
|
||||
})
|
||||
|
||||
const imgUrl=ref('')
|
||||
const imgUrl = ref('')
|
||||
|
||||
async function getImageStoreItem(item: any): Promise<string> {
|
||||
let image = ''
|
||||
if (item.url === 'Storage') {
|
||||
const key = item.id
|
||||
image = await imageDbStore.getItem(key) as string
|
||||
}
|
||||
else {
|
||||
image = item.url
|
||||
}
|
||||
|
||||
const getImageStoreItem=async (item:any):Promise<string>=>{
|
||||
let image=''
|
||||
if(item.url=='Storage'){
|
||||
const key=item.id;
|
||||
image=await imageDbStore.getItem(key) as string
|
||||
}
|
||||
else{
|
||||
image=item.url
|
||||
}
|
||||
|
||||
|
||||
return image
|
||||
return image
|
||||
}
|
||||
|
||||
onMounted(async ()=>{
|
||||
const image=await getImageStoreItem(props.imgItem)
|
||||
imgUrl.value=image
|
||||
onMounted(async () => {
|
||||
const image = await getImageStoreItem(props.imgItem)
|
||||
imgUrl.value = image
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<img :src="imgUrl" alt="Image" class="object-cover h-full rounded-xl"/>
|
||||
<img :src="imgUrl" alt="Image" class="object-cover h-full rounded-xl">
|
||||
</template>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
||||
Reference in New Issue
Block a user