Vue.component('product_quick_view', {
template: `
البائع
السعر
{{product.price}}{{product.currency}}
أضف للعربة
أضف للمفضلة
`,
props: ['product', 'href_url_template', 'api_url', 'site_url'],
data: function () {
return {
// 'href_url': this.href_url_template.replace("{product_id}", this.product.id).replace("{product_name}", this.product.name_en.replace('/', '').replace(' ', ''.replace('%20', ''))),
is_loading: true,
thisProduct: []
}
},
watch: {
product: {
handler: function (newVal, oldVal) {
// this.href_url = this.href_url_template.replace("{product_id}", this.product.id).replace("{product_name}", this.product.name_en.replace('/', '').replace(' ', ''.replace('%20', '')));
this.is_loading = true;
var thisCompo = this;
axios.get(this.api_url + '/products/get/' + this.product.id)
.then(function (response) {
thisCompo.thisProduct = response.data.data;
thisCompo.is_loading = false;
})
.catch(function (error) {
console.log(error);
});
}
}
},
methods: {
addToCartThis: function (product) {
addToCart(product);
}, addToFavsThis: function (product) {
addToFavs(product);
},
}
});