Code Monkey home page Code Monkey logo

bs-modal.vue's Introduction

bs-modal.vue

Use bootstrap modal with vue3. Supports the use of multiple modals.

Preparing

Create a vue3 project and install bootstrap5.

(Methods omitted)

Installation

npm install bs-modal-vue

How to Use

sample.vue

<template>
  <div class="hello">
    <h1>Modal Samples</h1>
    <bs-modal ref="bodyOnlyModalRef" class="fade">
      <h1>Body</h1>
    </bs-modal>
    <button type="button" class="btn btn-primary" v-on:click="showModal()">Show Modal</button>
  </div>
</template>
<script lang="ts">
import { defineComponent,ref } from 'vue';
import {BsModal} from "bs-modal-vue";
export default defineComponent({
  name: 'HelloWorld',
  setup(){
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    const bodyOnlyModalRef = ref<any>(null);
    return{
      bodyOnlyModalRef,
      showModal(){
        bodyOnlyModalRef.value?.showModal();
      }
    }
  },
  components:{
    BsModal
  }
});
</script>

Options

Use Footer

<bs-modal>
    <h1>Body</h1>
  <template v-slot:footer>
    <h1>Footer</h1>
  </template>
</bs-modal>

Fade Animation

<bs-modal class="fade">
    <h1>Body</h1>
</bs-modal>

.modal Settings

<bs-modal data-bs-backdrop="static">
  <h1> Static Backdrop</h1>
</bs-modal>

.modal-dialog Settings

<bs-modal :modal-dialog-settings="['modal-fullscreen']">
  <h1>Fullscreen!</h1>
</bs-modal>

Others can be found here.

PR / Issues

Please PR or Issues if you have any questions.

bs-modal.vue's People

Contributors

s-n-1-0 avatar

Watchers

 avatar

bs-modal.vue's Issues

Remove default fade animation

bs-modal.vueにてclass="modal fade"となっていますが、私の使用環境ではfadeなしで運用したいと思っています。
fade自体はmodalの必須要素ではないと思っているためbs-modal.vueからは削除し、必要であれば<bs-modal class="fade">とすればよいと思うのですがいかがでしょうか。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.