jeft-vue-confirm
Version:
vue-confirm-plugin
2 lines • 5.36 kB
JavaScript
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["jeft-vue-confirm"]=e():t["jeft-vue-confirm"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fb15")}({"08f7":function(t,e,n){},8875:function(t,e,n){var r,o,i;(function(n,s){o=[],r=s,i="function"===typeof r?r.apply(e,o):r,void 0===i||(t.exports=i)})("undefined"!==typeof self&&self,(function(){function t(){if(document.currentScript)return document.currentScript;try{throw new Error}catch(l){var t,e,n,r=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,o=/@([^@]*):(\d+):(\d+)\s*$/gi,i=r.exec(l.stack)||o.exec(l.stack),s=i&&i[1]||!1,a=i&&i[2]||!1,c=document.location.href.replace(document.location.hash,""),u=document.getElementsByTagName("script");s===c&&(t=document.documentElement.outerHTML,e=new RegExp("(?:[^\\n]+?\\n){0,"+(a-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),n=t.replace(e,"$1").trim());for(var p=0;p<u.length;p++){if("interactive"===u[p].readyState)return u[p];if(u[p].src===s)return u[p];if(s===c&&u[p].innerHTML&&u[p].innerHTML.trim()===n)return u[p]}return null}}return t}))},ee09:function(t,e,n){"use strict";var r=n("08f7"),o=n.n(r);o.a},fb15:function(t,e,n){"use strict";if(n.r(e),"undefined"!==typeof window){var r=window.document.currentScript,o=n("8875");r=o(),"currentScript"in document||Object.defineProperty(document,"currentScript",{get:o});var i=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(n.p=i[1])}var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.show?n("div",{staticClass:"pop-up"},[t.hasMark?n("div",{staticClass:"popup-mask"}):t._e(),n("transition",{attrs:{name:"bottom"}},[n("div",{class:["popup-note","bottom",{"popup-note-noBg":!t.bg}]},[t.bg?n("img",{staticClass:"popup-note-bg",attrs:{src:t.bg,alt:"confirm_bg"}}):t._e(),n("div",{staticClass:"pop-content"},[n("div",{class:["pop-tit",{centerTitle:!t.msg}]},[t._v(t._s(t.title))]),n("p",{staticClass:"pop-note pop-subTit"},[n("span",{staticClass:"msg",domProps:{innerHTML:t._s(t.msg)}})]),"alert"==t.type?n("div",{staticClass:"btn-wrapper",on:{click:function(e){return e.stopPropagation(),t.alertClick(e)}}},[n("span",{staticClass:"btn btn-block yes-btn"},[t._v(t._s(t.alertBtnText))])]):t._e(),"confirm"==t.type?n("div",{staticClass:"btn-wrapper"},[n("span",{staticClass:"btn",on:{touchstart:function(e){return e.preventDefault(),t.noClick(e)}}},[t._v(t._s(t.noBtnText))]),n("span",{staticClass:"btn yes-btn",on:{touchstart:function(e){return e.preventDefault(),t.yesClick(e)}}},[t._v(t._s(t.yesBtnText))])]):t._e()])])])],1):t._e()},a=[],c={props:{title:{type:String,default:"提示"},msg:{type:String,default:""},type:{type:String,default:"alert"},alertBtnText:{type:String,default:"我知道了"},yesBtnText:{type:String,default:"确定"},noBtnText:{type:String,default:"取消"},hasMark:{type:Boolean,default:!0},bg:{type:String,default:""}},data(){return{promiseStatus:null,show:!1}},methods:{confirm(){let t=this;return this.show=!0,new Promise((function(e,n){t.promiseStatus={resolve:e,reject:n}}))},noClick(){this.show=!1,this.promiseStatus&&this.promiseStatus.reject()},yesClick(){this.show=!1,this.promiseStatus&&this.promiseStatus.resolve()},alertClick(){this.show=!1,this.promiseStatus&&this.promiseStatus.resolve()}}},u=c;n("ee09");function p(t,e,n,r,o,i,s,a){var c,u="function"===typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),s?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=c):o&&(c=a?function(){o.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:o),c)if(u.functional){u._injectStyles=c;var p=u.render;u.render=function(t,e){return c.call(e),p(t,e)}}else{var l=u.beforeCreate;u.beforeCreate=l?[].concat(l,c):[c]}return{exports:t,options:u}}var l=p(u,s,a,!1,null,null,null),f=l.exports;let d={install(t,e){let n=t.extend(f),r=new n;r.$mount(document.createElement("div")),document.body.appendChild(r.$el),t.prototype.$confirm=function(t){return Object.assign(r,t),r.show=!0,e&&e.bg&&(r.bg=e.bg),r.confirm()}}};var m=d;e["default"]=m}})}));
//# sourceMappingURL=jeft-vue-confirm.umd.min.js.map