Skip to content
Snippets Groups Projects
Verified Commit 427e9d71 authored by Daniel Göbel's avatar Daniel Göbel
Browse files

Fix import of bootstrap JS plugins

#6
parent 241b4ba7
No related branches found
No related tags found
2 merge requests!22Version 1.0.0,!7Fix import of bootstrap JS plugins
<script setup lang="ts"> <script setup lang="ts">
defineProps<{ defineProps<{
modalId: string; modalID: string;
modalLabel: string; modalLabel: string;
staticBackdrop: boolean; staticBackdrop: boolean;
}>(); }>();
...@@ -9,7 +9,7 @@ defineProps<{ ...@@ -9,7 +9,7 @@ defineProps<{
<template> <template>
<div <div
class="modal" class="modal"
:id="modalId" :id="modalID"
tabindex="-1" tabindex="-1"
:aria-labelledby="modalLabel" :aria-labelledby="modalLabel"
aria-hidden="true" aria-hidden="true"
......
<script setup lang="ts"> <script setup lang="ts">
import { BucketService } from "@/client"; import { BucketService } from "@/client";
import type { BucketIn } from "@/client"; import type { BucketIn } from "@/client";
import { reactive } from "vue"; import { reactive, onMounted } from "vue";
import BootstrapModal from "@/components/BootstrapModal.vue"; import BootstrapModal from "@/components/BootstrapModal.vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
/*
import { onMounted } from "vue";
import { Modal } from "bootstrap"; import { Modal } from "bootstrap";
*/
const router = useRouter(); const router = useRouter();
const emit = defineEmits(["bucketCreated"]); const emit = defineEmits(["bucketCreated"]);
...@@ -22,20 +19,17 @@ const formState = reactive({ ...@@ -22,20 +19,17 @@ const formState = reactive({
loading: boolean; loading: boolean;
}); });
defineProps<{ const props = defineProps<{
modalid: string; modalID: string;
modallabel: string; modalLabel: string;
}>(); }>();
/* let createBucketModal: Modal | null = null;
let theModal: Modal | null = null;
const modal = ref(null as Element | null);
onMounted(() => { onMounted(() => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion createBucketModal = new Modal("#" + props.modalID);
theModal = Modal.getOrCreateInstance(modal.value!); console.log("Modal ID", props.modalID);
}); });
*/
function createBucket() { function createBucket() {
formState.validated = true; formState.validated = true;
...@@ -47,8 +41,7 @@ function createBucket() { ...@@ -47,8 +41,7 @@ function createBucket() {
BucketService.bucketCreateBucket(bucket) BucketService.bucketCreateBucket(bucket)
.then((createdBucket) => { .then((createdBucket) => {
emit("bucketCreated", createdBucket); emit("bucketCreated", createdBucket);
//console.log(theModal); createBucketModal?.hide();
//theModal?.hide();
bucket.name = ""; bucket.name = "";
bucket.description = ""; bucket.description = "";
formState.bucketNameTaken = false; formState.bucketNameTaken = false;
...@@ -80,9 +73,9 @@ function modalClosed() { ...@@ -80,9 +73,9 @@ function modalClosed() {
<template> <template>
<bootstrap-modal <bootstrap-modal
:modal-id="modalid" :modal-id="modalID"
:static-backdrop="true" :static-backdrop="true"
:modal-label="modallabel" :modal-label="modalLabel"
v-on="{ 'hidden.bs.modal': modalClosed }" v-on="{ 'hidden.bs.modal': modalClosed }"
> >
<template v-slot:header> Create new Bucket </template> <template v-slot:header> Create new Bucket </template>
......
...@@ -21,17 +21,5 @@ app.use(router); ...@@ -21,17 +21,5 @@ app.use(router);
app.mount("#app"); app.mount("#app");
// Import just what we need // eslint-disable-next-line @typescript-eslint/no-unused-vars
import { Modal, Collapse, Dropdown } from "bootstrap";
// import "bootstrap/js/dist/alert";
import "bootstrap/js/dist/button";
// import "bootstrap/js/dist/carousel";
import "bootstrap/js/dist/collapse";
import "bootstrap/js/dist/dropdown";
import "bootstrap/js/dist/modal";
// import "bootstrap/js/dist/offcanvas";
// import "bootstrap/js/dist/popover";
// import "bootstrap/js/dist/scrollspy";
// import "bootstrap/js/dist/tab";
// import "bootstrap/js/dist/toast";
// import "bootstrap/js/dist/tooltip";
...@@ -73,8 +73,8 @@ onMounted(() => { ...@@ -73,8 +73,8 @@ onMounted(() => {
</button> </button>
</div> </div>
<create-bucket-component <create-bucket-component
modalid="create-bucket-modal" modalID="create-bucket-modal"
modallabel="create-bucket-modal-label" modalLabel="create-bucket-modal-label"
@bucket-created="addBucket" @bucket-created="addBucket"
/> />
<div class="input-group flex-nowrap mt-2"> <div class="input-group flex-nowrap mt-2">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment