diff --git a/.editorconfig b/.editorconfig index 5d12634..2e1b261 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,13 +1,21 @@ -# editorconfig.org root = true [*] -indent_style = space -indent_size = 2 -end_of_line = lf charset = utf-8 -trim_trailing_whitespace = true +end_of_line = lf +indent_size = 4 +indent_style = space insert_final_newline = true +trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 + +[docker-compose.yml] +indent_size = 4 + +[*.vue] +indent_size = 2 diff --git a/app.vue b/app.vue index 83553ba..943ab14 100644 --- a/app.vue +++ b/app.vue @@ -1,27 +1,52 @@ @@ -32,18 +57,39 @@ import data from "data/test.json"; export default defineComponent({ name: "IndexPage", data(): { + modalId: string; data: typeof data selectedItem: Item | null } { return { + modalId: "exampleModal", data, selectedItem: null, }; }, + mounted() { + // * Make sure array does not start using 0 index + const items: typeof data.items = []; + this.data.items.forEach((item, itemIndex) => { + items[itemIndex +1] = item; + }); + this.data.items = items; + }, methods: { itemClicked(item: Item): void { this.selectedItem = item; + this.$nextTick(() => { + const el = document.getElementById(this.modalId); + if (!el) { + throw new Error(`Missing element ${this.modalId}`); + } + const { $Modal } = this.$nuxt; + new ($Modal as bsModal)(el).show(); + }); }, + isMultOf(numerator:number, divider: number):boolean { + return numerator % divider === 0; + } }, }); diff --git a/components/ProductModal.vue b/components/ProductModal.vue index 96b64c5..54a7eca 100644 --- a/components/ProductModal.vue +++ b/components/ProductModal.vue @@ -1,10 +1,10 @@