You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
11 KiB
1 lines
11 KiB
{"version":3,"sources":["webpack:////Users/jj/xuan-pay-cweb/components/pick-regions/pick-regions.vue?5267","webpack:////Users/jj/xuan-pay-cweb/components/pick-regions/pick-regions.vue?f7a6","webpack:////Users/jj/xuan-pay-cweb/components/pick-regions/pick-regions.vue?0d2e","webpack:////Users/jj/xuan-pay-cweb/components/pick-regions/pick-regions.vue?b5a2","uni-app:///components/pick-regions/pick-regions.vue"],"names":[],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAyH;AACzH;AACgE;AACL;;;AAG3D;AAC0M;AAC1M,gBAAgB,iNAAU;AAC1B,EAAE,kFAAM;AACR,EAAE,uFAAM;AACR,EAAE,gGAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,2FAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACtBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACRA;AAAA;AAAA;AAAA;AAA4yB,CAAgB,0yBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;;;;;ACWh0B,mE;AACA;AACA;AACA;AACA,iBADA;AAEA,aAFA,sBAEA;AACA;AACA,OAJA,EADA;;AAOA;AACA,kBADA,EAPA;;AAUA,kCAVA,EADA;;AAaA,MAbA,kBAaA;AACA;AACA,sCADA;AAEA,oDAFA;AAGA,2BAHA;AAIA,4BAJA;;AAMA,GApBA;AAqBA;AACA;AACA,aADA,mBACA,MADA,EACA,SADA,EACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SANA,MAMA;AACA;AACA,SAFA,MAEA;AACA;AACA;AACA,OAbA;AAcA,qBAdA,EADA,EArBA;;;AAuCA;AACA,cADA,wBACA;AACA;AACA,KAHA;AAIA,aAJA,uBAIA;AACA;AACA;AACA;AACA,qBADA;AAEA,+BAFA;AAGA,yCAHA;;AAKA;AACA;AACA,KAdA,EAvCA;;AAuDA;AACA,sBADA,8BACA,CADA,EACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAbA;;AAeA,OAhBA,CAgBA;AACA;AACA;AACA;;AAEA,KA7BA;AA8BA,qBA9BA,6BA8BA,CA9BA,EA8BA;AACA;AADA,2CAEA,cAFA,KAEA,MAFA,sBAEA,MAFA,sBAEA,MAFA;AAGA,oBAHA,KAGA,IAHA,sBAGA,IAHA,sBAGA,IAHA;AAIA;AACA;AACA;AACA,KArCA;AAsCA,uBAtCA,+BAsCA,MAtCA,EAsCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAFA,MAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAZA,MAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAlEA,EAvDA,E","file":"components/pick-regions/pick-regions.js","sourcesContent":["import { render, staticRenderFns, recyclableRender, components } from \"./pick-regions.vue?vue&type=template&id=32290738&\"\nvar renderjs\nimport script from \"./pick-regions.vue?vue&type=script&lang=js&\"\nexport * from \"./pick-regions.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"components/pick-regions/pick-regions.vue\"\nexport default component.exports","export * from \"-!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--16-0!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./pick-regions.vue?vue&type=template&id=32290738&\"","var components\nvar render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }","import mod from \"-!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./pick-regions.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./pick-regions.vue?vue&type=script&lang=js&\"","<template>\n <picker mode=\"multiSelector\" \r\n :value=\"multiIndex\" \r\n :range=\"multiArray\" \r\n @change=\"handleValueChange\"\r\n @columnchange=\"handleColumnChange\">\r\n <slot></slot>\r\n </picker>\n</template>\n\n<script>\r\n const CHINA_REGIONS = require('./regions.json')\r\n\texport default {\r\n props:{\r\n defaultRegions:{\r\n type:Array,\r\n default(){\r\n return []\r\n }\r\n },\r\n defaultRegionCode:{\r\n type:String\r\n },\r\n defaultRegion:[String,Array]\r\n },\n\t\tdata() {\n\t\t\treturn {\r\n cityArr:CHINA_REGIONS[0].childs,\r\n districtArr:CHINA_REGIONS[0].childs[0].childs,\r\n multiIndex: [0, 0, 0],\r\n isInitMultiArray:true,\r\n\t\t\t}\n\t\t},\r\n watch:{\r\n defaultRegion:{\r\n handler(region,oldRegion){\r\n if(Array.isArray(region)){\r\n // 避免传的是字面量的时候重复触发\r\n oldRegion = oldRegion || []\r\n if(region.join('')!==oldRegion.join('')){\r\n this.handleDefaultRegion(region)\r\n }\r\n }else if(region&®ion.length == 6){\r\n this.handleDefaultRegion(region)\r\n }else{\r\n console.warn('defaultRegion非有效格式')\r\n }\r\n },\r\n immediate:true,\r\n }\r\n },\r\n computed:{\r\n multiArray(){\r\n return this.pickedArr.map(arr=>arr.map(item=>item.name))\r\n },\r\n pickedArr(){\r\n // 进行初始化\r\n if(this.isInitMultiArray){\r\n return [\r\n CHINA_REGIONS,\r\n CHINA_REGIONS[0].childs,\r\n CHINA_REGIONS[0].childs[0].childs\r\n ]\r\n }\r\n return [CHINA_REGIONS,this.cityArr,this.districtArr];\r\n }\r\n },\n\t\tmethods: {\n handleColumnChange(e){\r\n // console.log(e);\r\n this.isInitMultiArray = false;\r\n const that = this;\r\n let col = e.detail.column;\r\n let row = e.detail.value;\r\n that.multiIndex[col] = row;\r\n try{\r\n switch(col){\r\n case 0:\r\n if(CHINA_REGIONS[that.multiIndex[0]].childs.length==0){\r\n that.cityArr = that.districtArr = [CHINA_REGIONS[that.multiIndex[0]]]\r\n break;\r\n }\r\n that.cityArr = CHINA_REGIONS[that.multiIndex[0]].childs\r\n that.districtArr = CHINA_REGIONS[that.multiIndex[0]].childs[that.multiIndex[1]].childs\r\n break;\r\n case 1:\r\n that.districtArr = CHINA_REGIONS[that.multiIndex[0]].childs[that.multiIndex[1]].childs\r\n break;\r\n case 2:\r\n break;\r\n }\r\n }catch(e){\r\n // console.log(e);\r\n that.districtArr = CHINA_REGIONS[that.multiIndex[0]].childs[0].childs\r\n }\r\n \r\n },\r\n handleValueChange(e){\r\n // 结构赋值\r\n let [index0,index1,index2] = e.detail.value;\r\n let [arr0,arr1,arr2] = this.pickedArr;\r\n let address = [arr0[index0],arr1[index1],arr2[index2]];\r\n // console.log(address);\r\n this.$emit('getRegion',address)\r\n },\r\n handleDefaultRegion(region){\r\n const isCode = !Array.isArray(region)\r\n this.isInitMultiArray = false;\r\n let children = CHINA_REGIONS\r\n for(let i=0;i<3;i++){\r\n for(let j=0;j<children.length;j++){\r\n let condition = isCode?children[j].code==region.slice(0,(i+1)*2):children[j].name.includes(region[i]);\r\n if(condition){\r\n // 匹配成功进行赋值\r\n // console.log(i,j,children.length-1);\r\n children = children[j].childs;\r\n if(i==0){\r\n this.cityArr = children\r\n }else if(i==1){\r\n this.districtArr = children\r\n }\r\n this.$set(this.multiIndex,i,j)\r\n // console.log(this.multiIndex);\r\n break;\r\n }else{\r\n // 首次匹配失败就用默认的初始化\r\n // console.log(i,j,children.length-1);\r\n if(i==0 && j==(children.length-1)){\r\n this.isInitMultiArray = true;\r\n }\r\n }\r\n }\r\n }\r\n }\n\t\t},\n\t}\n</script>\n"],"sourceRoot":""} |