dd-vue-screening
Version:
一个干净的轻量级移动端筛选插件,可选一级、两级、搜索等
2 lines • 18.1 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["screening"]=e():t["screening"]=e()})("undefined"!==typeof self?self:this,function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var a=e[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(o,a,function(e){return t[e]}.bind(null,a));return o},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")}({"0bfb":function(t,e,n){"use strict";var o=n("cb7c");t.exports=function(){var t=o(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},"19f2":function(t,e,n){},"214f":function(t,e,n){"use strict";n("b0c5");var o=n("2aba"),a=n("32e9"),i=n("79e5"),r=n("be13"),c=n("2b4c"),s=n("520a"),u=c("species"),l=!i(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),f=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();t.exports=function(t,e,n){var d=c(t),p=!i(function(){var e={};return e[d]=function(){return 7},7!=""[t](e)}),h=p?!i(function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[u]=function(){return n}),n[d](""),!e}):void 0;if(!p||!h||"replace"===t&&!l||"split"===t&&!f){var m=/./[d],w=n(r,d,""[t],function(t,e,n,o,a){return e.exec===s?p&&!a?{done:!0,value:m.call(e,n,o)}:{done:!0,value:t.call(n,e,o)}:{done:!1}}),y=w[0],v=w[1];o(String.prototype,t,y),a(RegExp.prototype,d,2==e?function(t,e){return v.call(t,this,e)}:function(t){return v.call(t,this)})}}},"230e":function(t,e,n){var o=n("d3f4"),a=n("7726").document,i=o(a)&&o(a.createElement);t.exports=function(t){return i?a.createElement(t):{}}},"23c6":function(t,e,n){var o=n("2d95"),a=n("2b4c")("toStringTag"),i="Arguments"==o(function(){return arguments}()),r=function(t,e){try{return t[e]}catch(n){}};t.exports=function(t){var e,n,c;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=r(e=Object(t),a))?n:i?o(e):"Object"==(c=o(e))&&"function"==typeof e.callee?"Arguments":c}},"2aba":function(t,e,n){var o=n("7726"),a=n("32e9"),i=n("69a8"),r=n("ca5a")("src"),c=n("fa5b"),s="toString",u=(""+c).split(s);n("8378").inspectSource=function(t){return c.call(t)},(t.exports=function(t,e,n,c){var s="function"==typeof n;s&&(i(n,"name")||a(n,"name",e)),t[e]!==n&&(s&&(i(n,r)||a(n,r,t[e]?""+t[e]:u.join(String(e)))),t===o?t[e]=n:c?t[e]?t[e]=n:a(t,e,n):(delete t[e],a(t,e,n)))})(Function.prototype,s,function(){return"function"==typeof this&&this[r]||c.call(this)})},"2b4c":function(t,e,n){var o=n("5537")("wks"),a=n("ca5a"),i=n("7726").Symbol,r="function"==typeof i,c=t.exports=function(t){return o[t]||(o[t]=r&&i[t]||(r?i:a)("Symbol."+t))};c.store=o},"2d00":function(t,e){t.exports=!1},"2d95":function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},"32e9":function(t,e,n){var o=n("86cc"),a=n("4630");t.exports=n("9e1e")?function(t,e,n){return o.f(t,e,a(1,n))}:function(t,e,n){return t[e]=n,t}},"386d":function(t,e,n){"use strict";var o=n("cb7c"),a=n("83a1"),i=n("5f1b");n("214f")("search",1,function(t,e,n,r){return[function(n){var o=t(this),a=void 0==n?void 0:n[e];return void 0!==a?a.call(n,o):new RegExp(n)[e](String(o))},function(t){var e=r(n,t,this);if(e.done)return e.value;var c=o(t),s=String(this),u=c.lastIndex;a(u,0)||(c.lastIndex=0);var l=i(c,s);return a(c.lastIndex,u)||(c.lastIndex=u),null===l?-1:l.index}]})},4630:function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},"520a":function(t,e,n){"use strict";var o=n("0bfb"),a=RegExp.prototype.exec,i=String.prototype.replace,r=a,c="lastIndex",s=function(){var t=/a/,e=/b*/g;return a.call(t,"a"),a.call(e,"a"),0!==t[c]||0!==e[c]}(),u=void 0!==/()??/.exec("")[1],l=s||u;l&&(r=function(t){var e,n,r,l,f=this;return u&&(n=new RegExp("^"+f.source+"$(?!\\s)",o.call(f))),s&&(e=f[c]),r=a.call(f,t),s&&r&&(f[c]=f.global?r.index+r[0].length:e),u&&r&&r.length>1&&i.call(r[0],n,function(){for(l=1;l<arguments.length-2;l++)void 0===arguments[l]&&(r[l]=void 0)}),r}),t.exports=r},5537:function(t,e,n){var o=n("8378"),a=n("7726"),i="__core-js_shared__",r=a[i]||(a[i]={});(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:o.version,mode:n("2d00")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},"584a":function(t,e){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},"5ca1":function(t,e,n){var o=n("7726"),a=n("8378"),i=n("32e9"),r=n("2aba"),c=n("9b43"),s="prototype",u=function(t,e,n){var l,f,d,p,h=t&u.F,m=t&u.G,w=t&u.S,y=t&u.P,v=t&u.B,g=m?o:w?o[e]||(o[e]={}):(o[e]||{})[s],b=m?a:a[e]||(a[e]={}),S=b[s]||(b[s]={});for(l in m&&(n=e),n)f=!h&&g&&void 0!==g[l],d=(f?g:n)[l],p=v&&f?c(d,o):y&&"function"==typeof d?c(Function.call,d):d,g&&r(g,l,d,t&u.U),b[l]!=d&&i(b,l,p),y&&S[l]!=d&&(S[l]=d)};o.core=a,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},"5f1b":function(t,e,n){"use strict";var o=n("23c6"),a=RegExp.prototype.exec;t.exports=function(t,e){var n=t.exec;if("function"===typeof n){var i=n.call(t,e);if("object"!==typeof i)throw new TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==o(t))throw new TypeError("RegExp#exec called on incompatible receiver");return a.call(t,e)}},"69a8":function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},"6a99":function(t,e,n){var o=n("d3f4");t.exports=function(t,e){if(!o(t))return t;var n,a;if(e&&"function"==typeof(n=t.toString)&&!o(a=n.call(t)))return a;if("function"==typeof(n=t.valueOf)&&!o(a=n.call(t)))return a;if(!e&&"function"==typeof(n=t.toString)&&!o(a=n.call(t)))return a;throw TypeError("Can't convert object to primitive value")}},7726:function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},"79e5":function(t,e){t.exports=function(t){try{return!!t()}catch(e){return!0}}},"7f7f":function(t,e,n){var o=n("86cc").f,a=Function.prototype,i=/^\s*function ([^ (]*)/,r="name";r in a||n("9e1e")&&o(a,r,{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(t){return""}}})},8378:function(t,e){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)},"83a1":function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t===1/e:t!=t&&e!=e}},"86cc":function(t,e,n){var o=n("cb7c"),a=n("c69a"),i=n("6a99"),r=Object.defineProperty;e.f=n("9e1e")?Object.defineProperty:function(t,e,n){if(o(t),e=i(e,!0),o(n),a)try{return r(t,e,n)}catch(c){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},"9b43":function(t,e,n){var o=n("d8e8");t.exports=function(t,e,n){if(o(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,o){return t.call(e,n,o)};case 3:return function(n,o,a){return t.call(e,n,o,a)}}return function(){return t.apply(e,arguments)}}},"9e1e":function(t,e,n){t.exports=!n("79e5")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},a21f:function(t,e,n){var o=n("584a"),a=o.JSON||(o.JSON={stringify:JSON.stringify});t.exports=function(t){return a.stringify.apply(a,arguments)}},b0c5:function(t,e,n){"use strict";var o=n("520a");n("5ca1")({target:"RegExp",proto:!0,forced:o!==/./.exec},{exec:o})},be13:function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},c69a:function(t,e,n){t.exports=!n("9e1e")&&!n("79e5")(function(){return 7!=Object.defineProperty(n("230e")("div"),"a",{get:function(){return 7}}).a})},ca5a:function(t,e){var n=0,o=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+o).toString(36))}},cb7c:function(t,e,n){var o=n("d3f4");t.exports=function(t){if(!o(t))throw TypeError(t+" is not an object!");return t}},cdc5:function(t,e,n){"use strict";var o=n("19f2"),a=n.n(o);a.a},d3f4:function(t,e){t.exports=function(t){return"object"===typeof t?null!==t:"function"===typeof t}},d8e8:function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},f499:function(t,e,n){t.exports=n("a21f")},fa5b:function(t,e,n){t.exports=n("5537")("native-function-to-string",Function.toString)},fb15:function(t,e,n){"use strict";var o;(n.r(e),"undefined"!==typeof window)&&((o=window.document.currentScript)&&(o=o.src.match(/(.+\/)[^\/]+\.js(\?.*)?$/))&&(n.p=o[1]));n("7f7f");var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"screening wrapper"},[n("div",{staticClass:"nav bm bm-f1"},t._l(this[this.sDataName],function(e,o){return n("div",{key:o,staticClass:"navCol bm bm-ac bm-pc",class:"col"+o+" clo"+e.search,style:e.search?"":"width: calc("+t.length+")",on:{click:function(n){return t.screeningNavClick(o,e)}}},[e.search?n("span",{staticClass:"bm bm-ac bm-pc bm-f1 search"},[n("i",{staticClass:"iconfont icon-31sousuo"})]):n("span",{staticClass:"bm bm-ac bm-pc bm-f1 notSearch"},[e.selectedData?n("span",[t._v(t._s(e.selectedData[e.stringName]))]):n("span",[t._v(t._s(e.default[e.stringName]))]),n("i",{staticClass:"iconfont icon-anzhuoxiala"})])])}),0),"opacity1"==t.opacity?n("div",{staticClass:"main bm bm-f1"},t._l(this[this.sDataName],function(e,o){return n("div",{key:o,staticClass:"mainCol bm bm-f1",class:"main"+o+" "+(e.mainColShow?e.mainColShow:"mainCol-out")},[e.indexeslist&&t.$slots.indexeslist?t._t("indexeslist"):n("div",{staticClass:"bm bm-f1"},[e.search||e.showTier?t._e():n("div",{staticClass:"conditionList bm-f1 bm-ver"},[e.default?n("div",{staticClass:"row bm bm-ac",class:t.defaultShow(e),on:{click:function(e){return t.conditionClick(o,"default")}}},[t._v(t._s(e.default[e.stringName]))]):t._e(),t._l(e.data,function(a,i){return n("div",{key:a[e.stringCode],staticClass:"row bm bm-ac",class:t.rowDataShow(a,e.selectedData),on:{click:function(n){return t.conditionClick(o,i,e.data)}}},[t._v(t._s(a[e.stringName]))])})],2),!e.search&&e.showTier&&2==e.showTier?n("div",{staticClass:"conditionDouble bm-f1 bm-ver"},[t._t("loc-city"),n("div",{staticClass:"menu bm bm-ver bm-f1"},[n("div",{ref:"menu-left",refInFor:!0,staticClass:"menu-left"},[n("div",{ref:e.showTier+"_"+o+"_default",refInFor:!0,staticClass:"menu-left-row bm bm-ac bm-pc",class:e.default.leftRowShow?e.default.leftRowShow:"leftRow-in",on:{click:function(e){return t.doubleClickLeft(o,"default")}}},[t._v(t._s(e.default[e.stringName]))]),t._l(e.data,function(a,i){return n("div",{key:i,ref:e.showTier+"_"+o+"_"+i,refInFor:!0,staticClass:"menu-left-row bm bm-ac bm-pc",class:a.leftRowShow?a.leftRowShow:"leftRow-out",on:{click:function(e){return t.doubleClickLeft(o,i,a)}}},[t._v(t._s(a[e.stringName]))])})],2),n("div",{staticClass:"menu-right"},t._l(t.doubleRightData.listData,function(o,a){return n("div",{key:a,staticClass:"menu-right-row bm bm-ac bm-pc",class:o.rightRowShow?o.rightRowShow:"rightRow-out",on:{click:function(e){return t.doubleClickRight(o,a)}}},[t._v(t._s(o[e.stringName]))])}),0)])],2):t._e()])],2)}),0):t._e(),n("div",{staticClass:"backdropBg",class:t.bgOpen,staticStyle:{"background-color":"rgba(0, 0, 0, 0.2)"},on:{click:function(e){return t.screeningClose()}}})])},i=[],r=(n("386d"),n("f499")),c=n.n(r),s={name:"screening",props:["screeningData","pageName"],data:function(){return{bgOpen:"bg-out",opacity:"opacity0",doubleRightListData:""}},created:function(){this.init()},watch:{screeningData:{handler:function(t,e){c()(t)!=c()(e)&&this.init()},deep:!0}},methods:{init:function(){this.sDataName=this.pageName+"ScreeningData",this[this.sDataName]=this.screeningData,this.length=this[this.sDataName].length,this.length=100/(this.length-1)+"% - "+46/(this.length-1)+"px",this.local("init"),this.bgOpen="bg-out"},defaultShow:function(t){return t.selectedData?t.selectedData.id==t.default.id?"default-in":t.defaultShow?t.defaultShow:"default-out":"default-in"},rowDataShow:function(t,e){return e&&t.id==e.id?"row-in":"row-out"},local:function(t){var e,n=this;n[n.sDataName].map(function(o,a){if(o.showTier&&2==o.showTier){var i=!1;e="init"==t?o.localCode:t,e&&o.data.length>0&&(i=!0),i?o.data.map(function(i,r){n.$set(n[n.sDataName][a].data[r],"leftRowShow","leftRow-out"),i.list.map(function(c,s){if(n.$set(n[n.sDataName][a].data[r].list[s],"rightRowShow","rightRow-out"),e==c.areaCode){if("init"==t||"default"==n.lastSelectedKey.rowKey?(o.default.leftRowShow="leftRow-out",o.default.rightRowShow="rightRow-out"):(n.$set(n[n.sDataName][a].data[n.lastSelectedKey.rowKey],"leftRowShow","leftRow-out"),n.$set(n[n.sDataName][a].data[n.lastSelectedKey.rowKey].list[n.lastSelectedKey.listKey],"rightRowShow","rightRow-out")),n.$set(n[n.sDataName][a].data[r],"leftRowShow","leftRow-in"),n.$set(n[n.sDataName][a].data[r].list[s],"rightRowShow","rightRow-in"),"init"!=t){var u=n.$refs[o.showTier+"_"+a+"_"+r];n.$refs["menu-left"][0].scrollTo?n.$refs["menu-left"][0].scrollTo(0,u[0].offsetTop-30):n.$refs["menu-left"][0].scrollTop=u[0].offsetTop-30}n.doubleRightData={key:a,leftKey:r,listData:i.list},n.lastSelectedKey={key:a,rowKey:r,listKey:s}}})}):(o.default["leftRowShow"]="leftRow-in",o.default["rightRowShow"]="rightRow-in",n.doubleRightData={key:a,leftKey:"default",listData:[o.default]},n.lastSelectedKey={key:a,rowKey:"default",listKey:0})}})},screeningNavClick:function(t,e){var n=this;e.search?this.$emit("search"):n[n.sDataName].map(function(e,o){if(e.showTier&&2==e.showTier&&e.data.length>0){var a=n.$refs[e.showTier+"_"+n.lastSelectedKey.key+"_"+n.lastSelectedKey.rowKey];n.$refs["menu-left"][0].scrollTo?n.$refs["menu-left"][0].scrollTo(0,a[0].offsetTop-30):n.$refs["menu-left"][0].scrollTop=a[0].offsetTop-30}e.search||(t==o?(n.$set(n[n.sDataName][o],"mainColShow","mainCol-in"),n.bgOpen="bg-in"):n.$set(n[n.sDataName][o],"mainColShow","mainCol-out"))})},screeningClose:function(){var t=this;t[t.sDataName].map(function(e,n){e.search||(t.$set(t[t.sDataName][n],"mainColShow","mainCol-out"),t.bgOpen="bg-out")})},conditionClick:function(t,e,n){var o=this;"default"==e?(o[o.sDataName][t].data.map(function(e,n){o.$set(o[o.sDataName][t].data[n],"rowShow","row-out")}),o[o.sDataName][t].defaultShow="default-in",o[o.sDataName][t].selectedData=o[o.sDataName][t].default,this.$emit("change",t,o[o.sDataName][t],"default",o[o.sDataName][t].default)):(n.map(function(n,a){e==a?o.$set(o[o.sDataName][t].data[a],"rowShow","row-in"):o.$set(o[o.sDataName][t].data[a],"rowShow","row-out")}),o[o.sDataName][t].defaultShow="default-out",o[o.sDataName][t].selectedData=n[e],this.$emit("change",t,o[o.sDataName][t],e,n[e])),setTimeout(function(){o.screeningClose()},360)},doubleClickLeft:function(t,e,n){var o=this;"default"==e?(o.$set(o[o.sDataName][t].default,"leftRowShow","leftRow-in"),o[o.sDataName][t].data.map(function(e,n){o.$set(o[o.sDataName][t].data[n],"leftRowShow","leftRow-out")}),o.doubleRightData={key:t,leftKey:"default",listData:[o[o.sDataName][t].default]}):(o.$set(o[o.sDataName][t].default,"leftRowShow","leftRow-out"),o[o.sDataName][t].data.map(function(n,a){var i="leftRow-out";e==a&&(i="leftRow-in"),o.$set(o[o.sDataName][t].data[a],"leftRowShow",i)}),o.doubleRightData={key:t,leftKey:e,listData:n.list})},doubleClickRight:function(t,e){var n,o=this,a=o.doubleRightData;if(o.lastSelectedKey){var i=o.lastSelectedKey;"default"==i.rowKey?o.$set(o[o.sDataName][i.key].default,"rightRowShow","rightRow-out"):o.$set(o[o.sDataName][i.key].data[i.rowKey].list[i.listKey],"rightRowShow","rightRow-out")}"default"==a.leftKey?(o.$set(o[o.sDataName][a.key].default,"rightRowShow","rightRow-in"),n=t,o.$set(o[o.sDataName][a.key],"selectedData",n),this.$emit("change",a.key,o[o.sDataName][a.key],"default",t)):(o.$set(o[o.sDataName][a.key].data[a.leftKey].list[e],"rightRowShow","rightRow-in"),n=o[o.sDataName][a.key].data[a.leftKey].list[e],o.$set(o[o.sDataName][a.key],"selectedData",n),this.$emit("change",a.key,o[o.sDataName][a.key],a.leftKey,o[o.sDataName][a.key].data[a.leftKey],e,t)),o.lastSelectedKey={key:a.key,rowKey:a.leftKey,listKey:e},setTimeout(function(){o.screeningClose()},360)}},mounted:function(){var t=this;setTimeout(function(){t.opacity="opacity1"},1e3)}},u=s;n("cdc5");function l(t,e,n,o,a,i,r,c){var s,u="function"===typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),o&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),r?(s=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__),a&&a.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},u._ssrRegister=s):a&&(s=c?function(){a.call(this,this.$root.$options.shadowRoot)}:a),s)if(u.functional){u._injectStyles=s;var l=u.render;u.render=function(t,e){return s.call(e),l(t,e)}}else{var f=u.beforeCreate;u.beforeCreate=f?[].concat(f,s):[s]}return{exports:t,options:u}}var f=l(u,a,i,!1,null,"748253e4",null),d=f.exports;d.install=function(t){t.component(d.name,d)};var p=d,h=[p],m=function t(e){t.installed||h.map(function(t){return e.component(t.name,t)})};"undefined"!==typeof window&&window.Vue&&m(window.Vue);var w={install:m,screening:p};e["default"]=w}})});
//# sourceMappingURL=screening.umd.min.js.map