UNPKG

vue-sui-toast

Version:

Vue 2.x port of sui toast component

1 lines 2.39 kB
(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?t(exports):typeof define==="function"&&define.amd?define(["exports"],t):t(e.vueSuiToast=e.vueSuiToast||{})})(this,function(e){"use strict";(function(){if(document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style"),a=' .vue-sui-toast[data-v-692f669e]{ display: inline-table; box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; position: fixed; top: 50%; left: 50%; text-align: center; z-index: 11000; transform: translate3d(-50%, -50%, 0); background: rgba(0, 0, 0, 0.8); border-radius: 20px; color: white; padding: 0 16px; height: 40px; line-height: 40px; font-size: 16px; font-family: "Helvetica Neue", Helvetica, sans-serif; width: auto; max-width: 100%; } .vue-sui-toast.v-enter[data-v-692f669e]{ opacity: 0; transform: translate3d(-50%, -50%, 0) scale(1.185); } .vue-sui-toast.v-enter-active[data-v-692f669e]{ transition-property: transform, opacity; transition-duration: .4s; } .vue-sui-toast.v-leave-active[data-v-692f669e]{ opacity: 0; z-index: 10999; transform: translate3d(-50%, -50%, 0) scale(0.815); transition-property: transform, opacity; transition-duration: .4s; } ';t.type="text/css";if(t.styleSheet){t.styleSheet.cssText=a}else{t.appendChild(document.createTextNode(a))}e.appendChild(t)}})();var t={render:function(){var e=this;var t=e.$createElement;var a=e._self._c||t;return a("transition",{on:{afterLeave:e.afterLeave}},[e.shown?a("div",{staticClass:"vue-sui-toast",class:e.extraClass},[e._v(e._s(e.msg))]):e._e()])},staticRenderFns:[],_scopeId:"data-v-692f669e",props:{msg:{type:String,required:true},extraClass:{type:String,default:""}},data:function e(){return{shown:false}},methods:{activate:function e(){this.shown=true},deactivate:function e(){this.shown=false},afterLeave:function e(){this.$el.parentNode.removeChild(this.$el);this.$destroy()}}};function a(e){var a=e.extend(t);e.prototype.$toast=function(e,t,i){if(t===void 0)t=2e3;if(i===void 0)i="";var n={msg:e,extraClass:i};var o=new a({propsData:n});var s=document.createElement("div");s.id="vue-sui-toast-"+Date.now();document.body.appendChild(s);o.$mount(s);o.activate();setTimeout(function(){o.deactivate()},t)}}if(typeof window!=="undefined"&&window.Vue){window.Vue.use(a)}e["default"]=a;Object.defineProperty(e,"__esModule",{value:true})});