refactor: streamline ImageLightbox and update ProductDetailPage for better image handling
- Removed unused `closeOnBackdropClick` option from `useImageLightbox` for cleaner code. - Simplified the product assignment in `ProductDetailPage` by creating a mutable copy of product data, ensuring proper handling of images and categories. These changes enhance the maintainability and clarity of the image handling components in the application.
This commit is contained in:
parent
3742937aea
commit
98934ed61d
3 changed files with 7 additions and 3 deletions
|
|
@ -89,7 +89,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch, onMounted } from 'vue'
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import { X, ChevronLeft, ChevronRight } from 'lucide-vue-next'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import ProgressiveImage from './ProgressiveImage.vue'
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ export function useImageLightbox(
|
|||
) {
|
||||
const {
|
||||
enableKeyboardNavigation = true,
|
||||
closeOnBackdropClick = true,
|
||||
enableSwipeGestures = true
|
||||
} = options
|
||||
|
||||
|
|
|
|||
|
|
@ -256,7 +256,12 @@ const loadProduct = async () => {
|
|||
throw new Error('Product not found')
|
||||
}
|
||||
|
||||
product.value = productData
|
||||
// Create a mutable copy to satisfy type requirements
|
||||
product.value = {
|
||||
...productData,
|
||||
images: productData.images ? [...productData.images] : undefined,
|
||||
categories: productData.categories ? [...productData.categories] : undefined
|
||||
}
|
||||
|
||||
// Update page title
|
||||
document.title = `${productData.name} - Product Details`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue