vc-popup
Version:
vue popup components with power position and animation support and back key support as well
27 lines (21 loc) • 740 B
JavaScript
import Vue from 'vue'
import PopupBase from './popup-base'
function popupRegister (name, template, popupConfig, defaultConfig) {
// 首字母大写
name = name[0].toUpperCase() + name.slice(1)
function popupTemplate (constructConfig) {
if (this === undefined) return console.log('记得加new~')
this.name = name
this.popupConfig = popupConfig
this.Template = Vue.extend(template)
this.config = this.constructConfig =
Object.assign({
animationConfigurable: true
}, defaultConfig, constructConfig)
}
popupTemplate.prototype = PopupBase
Vue.prototype.$popup[name] = popupTemplate
return popupTemplate
}
export { popupRegister }
export default popupRegister