addToCart async = await closeModalmod_productDetail; await storeValuecart appsmithstorecart concatidlst_productListselectedItemidmakelst_productList selectedItemmakemodellst_productListselect
addToCart: async () => {- This is the declaration of an asynchronous function calledaddToCart.await closeModal('mod_productDetail');- This line closes the modal with the ID ofmod_productDetail.await storeValue('cart', appsmith.store.cart.concat({id:lst_productList.selectedItem.id,make:lst_productList.selectedItem.make,model:lst_productList.selectedItem.model,qty:1,price:lst_productList.selectedItem.price,image:lst_productList.selectedItem.image}));- This line stores the current value of thecartproperty in theappsmith.storeobject, with a new item added to the end of the array. The new item contains theid,make,model,qty,price, andimageof the currently selected item from thelst_productListelement, with a quantity of1.await showAlert(${lst_productList.selectedItem.model} added to cart,'info')- This line displays an alert message with the model name of the selected item from thelst_productListelement, indicating that the item has been added to the cart. The alert type isinfo
原文地址: https://www.cveoy.top/t/topic/fi21 著作权归作者所有。请勿转载和采集!