UNPKG

@persagy2/meri-design

Version:

fork from meri-design and extend it.

7 lines 3.74 kB
/*! * @@persagy2/meri-design v1.4.9-extend.2 * (c) 2019-2020 xiongshuang * Released under the MIT License. * 2022-12-07 10:32:51 */ var t,e;t=this,e=function(){return function(){"use strict";var t={d:function(e,n){for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:function(){return o}});var n=function(t,e,n,r,o,i,s,a){var c,l="function"==typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=n,l._compiled=!0),r&&(l.functional=!0),i&&(l._scopeId="data-v-"+i),s?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},l._ssrRegister=c):o&&(c=a?function(){o.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:o),c)if(l.functional){l._injectStyles=c;var d=l.render;l.render=function(t,e){return c.call(e),d(t,e)}}else{var u=l.beforeCreate;l.beforeCreate=u?[].concat(u,c):[c]}return{exports:t,options:l}}({name:"Badge",props:{content:{type:[Number,String],default:""},dot:{type:String},bgColor:{type:String,default:"#f54e45"}},data:function(){return{contentArr:[],contentStr:""}},computed:{figure:function(){return[0,1,2,3,4,5,6,7,8,9]},countTitle:function(){return this.contentArr>100?this.content:""}},watch:{content:{handler:function(t,e){t!==e&&this.setContent(t)},immediate:!0}},methods:{setContent:function(t){if(isNaN(t))this.contentArr=[],this.contentStr=t;else{this.contentStr="";var e="number"==typeof t?String(t):t;this.contentArr=e.split("")}},handleClick:function(){this.$emit("click")}}},(function(){var t=this,e=t._self._c;return e("div",{staticClass:"p-badge",attrs:{title:t.countTitle},on:{click:t.handleClick}},[e("div",[t._t("default")],2),t._v(" "),"string"==typeof t.dot?e("div",{staticClass:"p-badge-normal p-badge-dot",style:{backgroundColor:t.bgColor}}):t.contentArr.length&&t.contentArr[0]>0?e("div",{staticClass:"p-badge-normal",style:{backgroundColor:t.bgColor}},[t.contentArr.length<3?e("section",{staticClass:"p-badge-text"},[t.contentArr[0]?e("article",{staticClass:"p-badge-figure",style:{transform:"translate3d(0,-".concat(18*t.contentArr[0],"px,0)")}},t._l(t.figure,(function(n){return e("span",{key:"n1-"+n},[t._v(t._s(n))])})),0):t._e(),t._v(" "),t.contentArr[1]?e("article",{staticClass:"p-badge-figure",style:{transform:"translate3d(0,-".concat(18*t.contentArr[1],"px,0)")}},t._l(t.figure,(function(n){return e("span",{key:"n2-"+n},[t._v(t._s(n))])})),0):t._e(),t._v(" "),t.contentArr[2]?e("article",{staticClass:"p-badge-add"},[t._v("+")]):t._e()]):e("section",{staticClass:"p-badge-text"},[t._m(0),t._v(" "),t._m(1),t._v(" "),e("article",{staticClass:"p-badge-add"},[t._v("+")])])]):t.contentStr?e("div",{staticClass:"p-badge-normal",style:{backgroundColor:t.bgColor}},[e("section",{staticClass:"p-badge-str"},[t._v(t._s(t.contentStr))])]):t._e()])}),[function(){var t=this._self._c;return t("article",{staticClass:"p-badge-figure"},[t("span",[this._v("9")])])},function(){var t=this._self._c;return t("article",{staticClass:"p-badge-figure"},[t("span",[this._v("9")])])}],!1,null,null,null),r=n.exports;r.install=function(t){return t.component(r.name,r)};var o=r;return e}()},"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Badge",[],e):"object"==typeof exports?exports.Badge=e():t.Badge=e();