Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 2x 2x 2x 6x 2x | <template> <div class="d-flex flex-column align-items-center position-relative"> <BIconSearch class="search-icon d-flex position-absolute" /> <SelectWithSearch :data="bundles" :filter="filterBundles" :clickItem="addBundle" :placeholder="'Serch bundles'" class="mb-3" > <template v-slot:item="bundles"> <BundleCard :bundle="bundles.item" class="w-100 m-0 p-0" /> </template> </SelectWithSearch> <div class="w-100" v-if="selectedBundles.length"> <ul class="d-flex flex-column p-0 w-100 m-0"> <li v-for="(item, index) in selectedBundles" :key="item.bundle.id" class="row w-100 mb-2 mx-auto justify-content-center" > <BundleCard :bundle="item.bundle" class="col-11 m-0 p-0" /> <div class="col-1 d-flex justify-content-center align-items-start p-0" v-on:click="deleteProduct(index)" > <BIconX /> </div> </li> </ul> </div> </div> </template> <script> import "~/utils/filters"; import SelectWithSearch from "~/components/common/SelectWithSearch.vue"; import BundleCard from "./BundleCard.vue"; export default { name: "BundlesBlock", components: { SelectWithSearch, BundleCard }, data: () => ({ bundles: [], selectedBundles: [], }), methods: { filterBundles: function (text, data) { return data.filter((item) => item.title.toLowerCase().includes(text.toLowerCase()) ); }, addBundle: function (item) { const index = this.selectedBundles.findIndex((p) => p.id === item.id); if (index === -1) { const obj = { bundle: item }; this.selectedBundles.push(obj); } this.$emit("setBundles", this.selectedBundles); }, deleteProduct: function (index) { this.selectedBundles.splice(index, 1); this.$emit("setBundles", this.selectedBundles); }, }, async beforeMount() { this.bundles = await this.$strapi.find("bundles"); }, }; </script> <style scoped> </style> |