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
9.4 KiB
1 lines
9.4 KiB
{"version":3,"sources":["webpack:///D:/Uni-App/HBuilderProjects/Test/components/pick-regions/pick-regions.vue?7b53","webpack:///D:/Uni-App/HBuilderProjects/Test/components/pick-regions/pick-regions.vue?4bff","uni-app:///components/pick-regions/pick-regions.vue","webpack:///D:/Uni-App/HBuilderProjects/Test/components/pick-regions/pick-regions.vue?f510"],"names":["renderjs","component","options","__file","components","render","_vm","this","_h","$createElement","_self","_c","staticRenderFns","_withStripped"],"mappings":"qIAAA,kHACIA,EADJ,OAQIC,EAAY,eACd,aACA,OACA,QACA,EACA,KACA,KACA,MACA,EACA,OACAD,GAGFC,EAAUC,QAAQC,OAAS,2CACZ,aAAAF,E,0CCtBf,8GAAwoB,eAAG,G,4iCCY3oB,a,EACA,CACE,MAAF,CACI,eAAJ,CACM,KAAN,MACM,QAFN,WAGQ,MAAR,KAGI,kBAAJ,CACM,KAAN,QAEI,cAAJ,gBAEA,KAbA,WAcA,OACM,QAAN,YACM,YAAN,sBACM,WAAN,QACM,kBAAN,IAGE,MAAF,CACI,cAAJ,CACM,QADN,SACA,KACA,kBAEU,EAAV,MACA,yBACY,KAAZ,wBAEA,eACU,KAAV,uBAEU,QAAV,4BAGM,WAAN,IAGE,SAAF,CACI,WADJ,WAEM,OAAN,+EAEI,UAJJ,WAMM,OAAN,sBACA,CACQ,EACA,EAAR,UACQ,EAAR,qBAGA,oCAGA,SACI,mBADJ,SACA,GAEM,KAAN,oBACM,IAAN,OACA,kBACA,iBACM,EAAN,gBACM,IACE,OAAR,GACU,KAAV,EACY,GAAZ,qCACc,EAAd,2CACc,MAEF,EAAZ,kCACY,EAAZ,8DACY,MACF,KAAV,EACY,EAAZ,8DACY,MACF,KAAV,EACY,OAEZ,SAEQ,EAAR,kDAII,kBA9BJ,SA8BA,GAAM,IAAN,IAEA,eAFA,GAEA,EAFA,KAEA,EAFA,KAEA,EAFA,SAGM,KAAN,UAHA,GAGA,EAHA,KAGA,EAHA,KAGA,EAHA,KAIA,mBAEM,KAAN,sBAEI,oBAtCJ,SAsCA,GACM,IAAN,oBACM,KAAN,oBAEM,IADA,IAAN,IACA,YACQ,IAAR,wBACU,IAAV,2DACU,GAAV,GAGY,EAAZ,YACA,KACc,KAAd,UACA,OACc,KAAd,eAEY,KAAZ,0BAEY,MAIZ,sBACc,KAAd,yB,8CCjIA,IAAIG,E,sGACJ,IAAIC,EAAS,WACX,IAAIC,EAAMC,KACNC,EAAKF,EAAIG,eACJH,EAAII,MAAMC,IAGjBC,EAAkB,GACtBP,EAAOQ,eAAgB","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 \"!../../../../../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","import mod from \"-!../../../../../HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../../HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../../HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../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 \"-!../../../../../HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../../HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../../HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../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\t\t\t>\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","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 }"],"sourceRoot":""}
|