Basic

You now can use modal as an async request, and insert to your action.

import Vuex from 'vuex';
import Modal from 'smv-modal';

const mockGet = () => {};
const confirmModal = Modal({
  title: 'Confirm',
  modalStyle: {
    width: '400px',
    height: '240px',
  },
  content: 'Do you really want to delete this item?',
});

const store = new Vuex.Store({
  state: {
    count: 0
  },
  actions: {
    async deleteItem (context) {
      const resp = await confirmModal.show();
      if (resp.type === 'confirm') {
        mockGet(`/shop/delete/${context.id}`);
      } else {
        console.log('cancel delete')
      }
    }
  }
})

shorthand

Thanks for template literals, you can write something like

const modal = Modal`I'am content`;
modal.show();

shorthand for title & content

import ModalContent from './ModalContent.vue';

const modalWithSFC = Modal`${ModalContent}`;
const modalWithTitle = Modal`${'title here'} ${'content here'}`;
const modalWithTitle2 = Modal`${'title here'} ${ModalContent}`;
Last Updated: 9/27/2018, 3:23:37 AM