1.0.1 • Published 1 year ago

vue-functional-popup v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Install

npm install --save vue-functional-popup

Usage

  1. create and use
import Popup from 'vue-functional-popup'
const popup = new Popup()

// App.vue
<div>
  <FunctionalPopup /> // add
</div>

// main.ts
createApp(App).use(popup)
  1. in setup()
// setup()
import Popup, { usePopup } from 'vue-functional-popup'
import ComponentPopup from './ComponentPopup.vue'
// first register
Popup.register('popup_name', () => import('./ComponentPopup.vue')) // lazy load
Popup.register('popup_name2', ComponentPopup) // register

// second use
const popup = usePopup()
let promisePopup = popup.show('popup_name') // 如果有注册的话

// use without register
promisePopup = popup.show(ComponentPopup, { callback })
const handler = popup.show(ComponentPopup, { callback }, true)
  1. in methods
  say() {
    this.$popup.show('popup_name')
  }
  1. more example

License

MIT License.

1.0.1

1 year ago

1.0.0

1 year ago