UNPKG

captain-ui

Version:

有赞vue wap业务组件库

53 lines (42 loc) 1.49 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.default = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _vue = _interopRequireDefault(require("vue")); var _BehaviorCaptcha = _interopRequireDefault(require("./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.default.extend(_BehaviorCaptcha.default); var behaviorCaptcha = new Com({ propsData: (0, _extends2.default)({}, 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.default.openBehaviorCaptcha = openBehaviorCaptcha; var _default = _BehaviorCaptcha.default; exports.default = _default;