Добавить мод загрузки в шаблон приложения - программирование
Подтвердить что ты не робот

Добавить мод загрузки в шаблон приложения

Я использую bootstrap-vue модальный:

В моем проекте 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 или другому шаблону \tag?

P.S: только для this.$bvModal.msgBoxConfirm с then... чтобы не создавать ненужных методов... из-за количества всплывающих окон с различной логикой

4b9b3361