UNPKG

captain-ui

Version:

有赞vue wap业务组件库

41 lines (37 loc) 1.17 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import Vue from 'vue'; import BehaviorCaptcha from './BehaviorCaptcha'; var openBehaviorCaptcha = function openBehaviorCaptcha(options) { if (options === void 0) { options = { className: '', onSuccess: function onSuccess() {}, onFail: function onFail() {}, onCancel: function onCancel() {} }; } var el = document.createElement('div'); document.body.appendChild(el); var Com = Vue.extend(BehaviorCaptcha); var behaviorCaptcha = new Com({ propsData: _extends({}, options, { showType: 'pop', destroy: function destroy() { behaviorCaptcha.$destroy(); document.body.removeChild(behaviorCaptcha.$el); } }) }); behaviorCaptcha.$on('success', options.onSuccess); behaviorCaptcha.$on('fail', options.onFail); behaviorCaptcha.$on('cancel', function () { if (options.onCancel) { options.onCancel(); } behaviorCaptcha.$destroy(); document.body.removeChild(behaviorCaptcha.$el); }); behaviorCaptcha.$mount(el); }; BehaviorCaptcha.openBehaviorCaptcha = openBehaviorCaptcha; export default BehaviorCaptcha;