File tree Expand file tree Collapse file tree 5 files changed +16
-11
lines changed
packages/theme/modules/catalog/product
composables/useProductGallery Expand file tree Collapse file tree 5 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ import {
115115 ref ,
116116 computed ,
117117 defineComponent ,
118- PropType ,
118+ PropType , toRef ,
119119} from ' @nuxtjs/composition-api' ;
120120
121121import {
@@ -170,8 +170,9 @@ export default defineComponent({
170170 },
171171 setup(props ) {
172172 const qty = ref (1 );
173+ const product = toRef (props , ' product' );
173174 const { addItem, canAddToCart } = useCart ();
174- const { productGallery, imageSizes } = useProductGallery (props . product );
175+ const { productGallery, imageSizes } = useProductGallery (product );
175176 const { activeTab, setActiveTab, openNewReviewTab } = useProductTabs ();
176177 const { isAuthenticated } = useUser ();
177178 const { addItem : addItemToWishlist, isInWishlist } = useWishlist ();
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ import {
170170 useRoute ,
171171 useRouter ,
172172 defineComponent ,
173- PropType ,
173+ PropType , toRef ,
174174} from ' @nuxtjs/composition-api' ;
175175
176176import {
@@ -227,10 +227,11 @@ export default defineComponent({
227227 },
228228 setup(props , { emit }) {
229229 const qty = ref (1 );
230+ const product = toRef (props , ' product' );
230231 const route = useRoute ();
231232 const router = useRouter ();
232233 const { addItem, loading : isCartLoading, canAddToCart } = useCart ();
233- const { productGallery, imageSizes } = useProductGallery (props . product );
234+ const { productGallery, imageSizes } = useProductGallery (product );
234235 const { activeTab, setActiveTab, openNewReviewTab } = useProductTabs ();
235236
236237 const { isAuthenticated } = useUser ();
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ import {
114114 ref ,
115115 computed ,
116116 defineComponent ,
117- PropType ,
117+ PropType , toRef ,
118118} from ' @nuxtjs/composition-api' ;
119119
120120import {
@@ -169,8 +169,9 @@ export default defineComponent({
169169 },
170170 setup(props ) {
171171 const qty = ref (1 );
172+ const product = toRef (props , ' product' );
172173 const { addItem, canAddToCart } = useCart ();
173- const { productGallery, imageSizes } = useProductGallery (props . product );
174+ const { productGallery, imageSizes } = useProductGallery (product );
174175 const { activeTab, setActiveTab, openNewReviewTab } = useProductTabs ();
175176
176177 const { isAuthenticated } = useUser ();
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ import {
118118 computed ,
119119 defineComponent ,
120120 PropType ,
121+ toRef ,
121122} from ' @nuxtjs/composition-api' ;
122123
123124import {
@@ -170,8 +171,9 @@ export default defineComponent({
170171 },
171172 setup(props ) {
172173 const qty = ref (1 );
174+ const product = toRef (props , ' product' );
173175 const { addItem, loading : isCartLoading, canAddToCart } = useCart ();
174- const { productGallery, imageSizes } = useProductGallery (props . product );
176+ const { productGallery, imageSizes } = useProductGallery (product );
175177 const { isAuthenticated } = useUser ();
176178 const { addItem : addItemToWishlist, isInWishlist } = useWishlist ();
177179 const { activeTab, setActiveTab, openNewReviewTab } = useProductTabs ();
Original file line number Diff line number Diff line change 1- import { computed } from '@nuxtjs/composition-api' ;
1+ import { computed , Ref } from '@nuxtjs/composition-api' ;
22import { getGallery as getProductGallery } from '~/modules/catalog/product/getters/productGetters' ;
33import { useImage } from '~/composables' ;
44import type { Product } from '~/modules/catalog/product/types' ;
@@ -9,13 +9,13 @@ import type { UseProductGalleryInterface } from '~/modules/catalog/product/compo
99 *
1010 * See the {@link UseProductGalleryInterface} page for more information.
1111 */
12- export function useProductGallery ( product : Product ) : UseProductGalleryInterface {
12+ export function useProductGallery ( product : Ref < Product > ) : UseProductGalleryInterface {
1313 const { getMagentoImage, imageSizes } = useImage ( ) ;
14- const productGallery = computed ( ( ) => getProductGallery ( product ) . map ( ( img ) => ( {
14+ const productGallery = computed ( ( ) => getProductGallery ( product . value ) . map ( ( img ) => ( {
1515 mobile : { url : getMagentoImage ( img . small ) } ,
1616 desktop : { url : getMagentoImage ( img . normal ) } ,
1717 big : { url : getMagentoImage ( img . big ) } ,
18- alt : product . name ,
18+ alt : product . value . name ,
1919 } ) ) ) ;
2020
2121 return {
You can’t perform that action at this time.
0 commit comments