<template>
<b-row>
<b-col sm="6" lg="4" xl="3" v-for="product in products" :key="product.id">
<div class="image" v-lazy:background-image="product.image">
Видно если нажали "Купить".
</div>
<div class="d-flex justify-content-between">
<div>
<p class="mb-0">{{product.name}}</p>
<p class="mb-0">{{product.price}} грн.</p>
</div>
<b-button class="align-self-center" variant="outline-dark" @click="buyProduct(product)">Купить</b-button>
</div>
</b-col>
</b-row>
</template>
<script lang="javascript">
import { BRow, BCol, BButton } from 'bootstrap-vue'
import { mapState, mapActions } from 'vuex'
export default {
components: {
BRow,
BCol,
BButton
},
computed: mapState({
products: state => state.product.all
}),
methods: {
buyProduct(product){
console.log(product)
}
}
}
</script>
<b-button class="align-self-center" variant="outline-dark" @click.once="buyProduct(product.id)">Купить</b-button>
echo json_encode($customers);
return $response->withJson($data);
header('Content-Type: application/json'); //HTTP загловок
echo json_encode($customers);
die(); //Стоп. Не возвращаем стандартный response от слима
class="align-self-start"
, чтобы он был на всю высоту./*
9 = 00000000000000000000000000001001
14 = 00000000000000000000000000001110
--------------------------------
14 ^ 9 = 00000000000000000000000000000111 = 7
*/
var result = 14 ^ 9;
console.log(result); // 7
var destination = jQuery('#tb-courses').offset().top;
jQuery(".tb-courses-menu a").click(function (e) {
var courseToggle = jQuery("#courseToggle").prop("checked");
e.preventDefault();
if (courseToggle) {
jQuery("#courseToggle").prop("checked", false);
jQuery("#tb-services").hide();
jQuery("#tb-courses").show();
var destination = jQuery('#tb-courses').offset().top;
jQuery('html, body').animate({ scrollTop: destination }, 1100);
}
})