@persagy2/meri-design
Version:
fork from meri-design and extend it.
7 lines • 5.24 kB
JavaScript
/*!
* @@persagy2/meri-design v1.4.9-extend.2
* (c) 2019-2020 xiongshuang
* Released under the MIT License.
* 2022-12-07 10:31:52
*/
var t,e;t=this,e=function(){return function(){"use strict";var t={d:function(e,o){for(var n in o)t.o(o,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:o[n]})},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={};function o(t,e,o,n,r,i,s,a){var l,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=o,c._compiled=!0),n&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),s?(l=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__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},c._ssrRegister=l):r&&(l=a?function(){r.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:r),l)if(c.functional){c._injectStyles=l;var d=c.render;c.render=function(t,e){return l.call(e),d(t,e)}}else{var p=c.beforeCreate;c.beforeCreate=p?[].concat(p,l):[l]}return{exports:t,options:c}}t.r(e),t.d(e,{default:function(){return s}});var n=o({},(function(){var t=this._self._c;return t("svg",{attrs:{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}},[t("g",{attrs:{transform:"translate(8.000000, -9.000000)"}},[t("path",{staticClass:"svg-fill-grey-500",attrs:{transform:"rotate(45.000000)",d:"M11.3849873,11.346892 L11.3849873,3.72784442 L12.9087968,3.72784442 L12.9087968,11.346892 L20.5278444,11.346892 L20.5278444,12.8707016 L12.9087968,12.8707016 L12.9087968,20.4897492 L11.3849873,20.4897492 L11.3849873,12.8707016 L3.76593965,12.8707016 L3.76593965,11.346892 L11.3849873,11.346892 Z"}})])])}),[],!1,null,null,null).exports,r=o({name:"Loading16px",props:{color:{type:String,default:"#fff"}}},(function(){var t=this._self._c;return t("div",{staticClass:"p-loading16px"},[t("svg",{staticClass:"p-loading16px-line",attrs:{viewBox:"0 0 16 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}},[t("path",{attrs:{d:"M9,1 A7,7 0 0,1 15,7",fill:"none","stroke-width":"1",stroke:this.color}})])])}),[],!1,null,null,null).exports;r.install=function(t){return t.component(r.name,r)};var i=o({name:"Drawer",components:{IconClose:n,Loading16px:r},props:{show:{type:Boolean,default:!1,require:!0},shadow:{type:Boolean,default:!1},penetrate:{type:Boolean,default:!1},focus:{type:Boolean,default:!1},bottom:{type:Boolean,default:!1},loadingMore:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},top:{type:[String,Number],default:""},componentId:{type:String,default:""}},data:function(){return{autoClose:!1,scrollTop:0,tabIndex:-1,clientWidth:0,clientHeight:0}},watch:{focus:{handler:function(t,e){t!==e&&(this.autoClose=t)},immediate:!0}},mounted:function(){var t=this;this.$nextTick((function(){window.addEventListener("mousedown",t.checkPointer,!1),t.$once("hook:beforeDestroy",(function(){window.removeEventListener("mousedown",t.checkPointer)}))}))},methods:{checkPointer:function(t){var e=this.focus,o=this.show;if(e&&o){var n=window.innerWidth,r=this.$refs.drawerBox.clientWidth;t.x<n-r&&this.onClose()}},onClose:function(){this.$emit("close",!1)},contentScroll:function(t){var e=this;this.loadingMore||this.$nextTick((function(){var o=t.target,n=o.scrollTop,r=o.scrollHeight;n+o.getBoundingClientRect().height===r&&e.$emit("getMore")}))}}},(function(){var t=this,e=t._self._c;return e("transition",{attrs:{name:"slideRightLeft"}},[e("div",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],staticClass:"p-drawer-box"},[t.shadow?e("div",{class:["p-drawer-shadow",t.penetrate&&"p-drawer-shadow-event"]}):t._e(),t._v(" "),e("div",{ref:"drawerBox",staticClass:"p-drawer",style:t.top&&{top:"".concat(t.top,"px"),height:"calc(100% - ".concat(t.top,"px)")}},[e("div",{staticClass:"p-drawer-title"},[e("section",{staticClass:"p-drawer-title-content"},[t._t("title")],2),t._v(" "),e("i",{staticClass:"p-drawer-title-icon",on:{click:t.onClose}},[e("IconClose")],1)]),t._v(" "),e("div",{class:["p-drawer-content",t.bottom&&"p-drawer-content-bottom"],attrs:{id:t.componentId},on:{scroll:t.contentScroll}},[t._t("content"),t._v(" "),t.loadingMore?e("section",{staticClass:"p-drawer-content-loading"},[e("Loading16px",{staticClass:"p-loading16px-drawer"}),t._v(" "),e("span",[t._v("加载中...")])],1):t._e()],2),t._v(" "),t.$slots.handle?e("div",{class:["p-drawer-handle",t.bottom&&"p-drawer-handle-bottom"]},[t._t("handle")],2):t._e(),t._v(" "),t.loading?e("div",{staticClass:"p-drawer-loading"},[e("section",{staticClass:"p-drawer-loading-svg"},[e("Loading16px",{attrs:{color:"#c3c7cb"}})],1)]):t._e()])])])}),[],!1,null,null,null).exports;i.install=function(t){return t.component(i.name,i)};var s=i;return e}()},"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Drawer",[],e):"object"==typeof exports?exports.Drawer=e():t.Drawer=e();