lee-select-city.js 6.3 KB

12345678910
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/lee-select-city/lee-select-city"],{1739:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=c(n("a34a")),i=c(n("a1b4")),u=c(n("9b65"));function c(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n,r,i,u,c){try{var o=t[u](c),a=o.value}catch(l){return void n(l)}o.done?e(a):Promise.resolve(a).then(r,i)}function a(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var u=t.apply(e,n);function c(t){o(u,r,i,c,a,"next",t)}function a(t){o(u,r,i,c,a,"throw",t)}c(void 0)}))}}function l(t,e){var n;if("undefined"===typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=s(t))||e&&t&&"number"===typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,c=!0,o=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return c=t.done,t},e:function(t){o=!0,u=t},f:function(){try{c||null==n.return||n.return()}finally{if(o)throw u}}}}function s(t,e){if(t){if("string"===typeof t)return f(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(t,e):void 0}}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function d(t){throw new Error('"'+t+'" is read-only')}var h=function(){n.e("components/lee-select-city/lee-latter-list").then(function(){return resolve(n("f4fa"))}.bind(null,n)).catch(n.oe)},v={components:{LeeLatterList:h},props:{height:{type:String,default:"100%"},data:{type:Array,default:function(){return JSON.parse(JSON.stringify(i.default))}},hotCities:{type:Array,default:function(){return JSON.parse(JSON.stringify(u.default))}},getPosition:Function,defaultSelected:{type:Array,default:function(){return[]}}},data:function(){var t=[];if(this.defaultSelected){var e,n=this.data,r=l(this.defaultSelected);try{var i=function(){var r=e.value,i=n.find((function(t){return t.name===r}));if(!i)return d("currentSelected"),t=[],"break";t.push(i),n=i.children||[]};for(r.s();!(e=r.n()).done;){var u=i();if("break"===u)break}}catch(c){r.e(c)}finally{r.f()}}return{currentLevel:Math.min(2,this.defaultSelected.length),currentSelected:t,showPlaceholder:!0,currentPosition:null}},computed:{dataByLetter:function(){return this.formatByLatter(this.data)},level2Data:function(){var t=this.currentSelected[0];return t?this.formatByLatter(t.children||[]):[]},level3Data:function(){var t=this.currentSelected[1];return t?this.formatByLatter(t.children||[]):[]},placeholder:function(){var t=this.currentSelected.length;return 0===t?"请选择地区":1===t?"请选择城市":2===t?"请选择县":""}},created:function(){var t=this;return a(r.default.mark((function e(){return r.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.getNewPosition();case 2:console.log(t.data);case 3:case"end":return e.stop()}}),e)})))()},methods:{selectPro:function(t){this.currentSelected=[t],console.log(),this.level2Data.length?this.currentLevel=1:this.submit()},selectCity:function(t){this.currentSelected.splice(1),this.$set(this.currentSelected,1,t),this.level3Data.length?this.currentLevel=2:this.submit()},selectQu:function(e){this.currentSelected.splice(2),this.$set(this.currentSelected,2,e),this.submit(),this.$store.commit("setChoose",{chooseProvince:this.currentSelected[0].name,chooseCity:this.currentSelected[1].name,chooseDistrict:this.currentSelected[2].name}),this.$api.prePage().reGetStoreList(),t.switchTab({url:"/pages/index/index"})},skipLevel:function(t){this.currentLevel=t},submit:function(){var t=this.currentSelected.slice(0),e=t.map((function(t){return t.name}));this.$emit("submit",{simple:e,selected:t})},hotCitySelectHandler:function(t){var e,n=this.data,r=[],i=l(t[1]);try{var u=function(){var t=e.value,i=n.find((function(e){return e.name===t}));return i?(n=i.children,n&&0!==n.length?void r.push(i):{v:void 0}):{v:void 0}};for(i.s();!(e=i.n()).done;){var c=u();if("object"===typeof c)return c.v}}catch(a){i.e(a)}finally{i.f()}this.currentSelected=r;var o=r.length;1===o&&this.level2Data.length||2===o&&this.level3Data.length?this.currentLevel=o:this.submit()},selectCurrentPosition:function(){this.$emit("select-current",this.currentPosition)},getNewPosition:function(){var t=this;return a(r.default.mark((function e(){return r.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if("function"!==typeof t.getPosition){e.next=4;break}return e.next=3,t.getPosition();case 3:t.currentPosition=e.sent;case 4:case"end":return e.stop()}}),e)})))()},formatByLatter:function(t){return t.reduce((function(t,e){if(!e.latter)return t;var n=t.find((function(t){return t[0]===e.latter}));return n||(n=[e.latter,[]],t.push(n)),n[1].push(e),n[1].sort((function(t,e){return t.name-e.name})),t}),[]).sort((function(t,e){return t[0].charCodeAt(0)-e[0].charCodeAt(0)}))}}};e.default=v}).call(this,n("543d")["default"])},"737c":function(t,e,n){"use strict";n.r(e);var r=n("1739"),i=n.n(r);for(var u in r)"default"!==u&&function(t){n.d(e,t,(function(){return r[t]}))}(u);e["default"]=i.a},c167:function(t,e,n){},e1a3:function(t,e,n){"use strict";var r=n("c167"),i=n.n(r);i.a},e5ba:function(t,e,n){"use strict";var r;n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return u})),n.d(e,"a",(function(){return r}));var i=function(){var t=this,e=t.$createElement;t._self._c},u=[]},f790:function(t,e,n){"use strict";n.r(e);var r=n("e5ba"),i=n("737c");for(var u in i)"default"!==u&&function(t){n.d(e,t,(function(){return i[t]}))}(u);n("e1a3");var c,o=n("f0c5"),a=Object(o["a"])(i["default"],r["b"],r["c"],!1,null,null,null,!1,r["a"],c);e["default"]=a.exports}}]);
  2. ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
  3. 'components/lee-select-city/lee-select-city-create-component',
  4. {
  5. 'components/lee-select-city/lee-select-city-create-component':(function(module, exports, __webpack_require__){
  6. __webpack_require__('543d')['createComponent'](__webpack_require__("f790"))
  7. })
  8. },
  9. [['components/lee-select-city/lee-select-city-create-component']]
  10. ]);