HamSter007
@HamSter007
HTML/CSS верстальщик

Как при открытии bootstrap-vue модального окна добавлять его внутрь определенного тега?

Использую bootstrap-vue modal:

codesandbox:
<template>
  <b-button variant="link" class="btn-remove" @click="removeItemFromOrder(index)">
    Remove item
  </b-button>
</template>
<script>
export default {
  name: "HelloWorld",
  methods: {
    removeItemFromOrder: async function (position) {
        let self = this

        const h = this.$createElement

        const titleVNode = h('div', { domProps: { innerHTML: '<h2>Remove this item?</h2>' } })

        const messageVNode = h('div', { class: ['modal-complete'] }, [

          h('div', {
            domProps: {
              innerHTML:  '<h2>Remove this item?</h2>'+
                          '<span class="popup-meta">'+
                            'Are you sure you want to remove this item?'+
                          '</span>'
            }
          })
        ])


        this.$bvModal.msgBoxConfirm([messageVNode], {
          title: [],
          centered: true,
          modalClass: 'success-popup',
          hideHeader:true,
          footerClass: 'd-flex justify-content-center align-items-center',
          cancelVariant: 'outline-danger',
          okVariant: 'danger',
          okTitle: 'YES',
          cancelTitle: 'NO',
          ststic: false
        })
          .then(async function (result) {
            if (result) {
              self.currentOrder.items.splice(position, 1)
              await self.sync()
            }
          })
          .catch(err => {
            // An error occurred
          })
      },
  }
};
</script>


При открытии окна, оно добавляется в body.

Вопрос: Как при открытии bootstrap-vue модального окна добавлять его внутрь app или в любое другое место template\tag ?
  • Вопрос задан
  • 151 просмотр
Пригласить эксперта
Ответы на вопрос 1
Astatroth
@Astatroth
Я тут случайно
Зачем его создавать? У Bootstrap-vue есть компонент для модалки, добавьте его в шаблон компонента.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы