Advertisement
Hanafi112

app.js

May 1st, 2023
921
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.45 KB | Source Code | 0 0
  1. var app = new Vue({
  2.     el: '#app',
  3.     data: {
  4.         maximum: 50,
  5.         products: null,
  6.         cart: []
  7.     },
  8.     mounted: function() {
  9.         fetch('https://hplussport.com/api/products/order/price')
  10.         .then(response => response.json())
  11.         .then(data => {
  12.             this.products = data;
  13.         });
  14.     },
  15.     methods: {
  16.         addItem: function (product) {
  17.             this.cart.push(product);
  18.         }
  19.     }
  20. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement