In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
The editor will share with you the example analysis of the three-level linkage of provinces, cities and regions in the development of Mini Program components. I hope you will get something after reading this article. Let's discuss it together.
Index.wxml
Index.js
Var city = require (".. /.. / utils/city.js"); Page ({data: {}, onLoad: function () {console.log ('onLoad...'); var that = this; city.init (that);}})
Address-temp.wxml
{{province [provinceIndex]}} {{city [cityIndex]}} {{district [districtIndex]}}
City.js
Var city = {province: ['- Please select -', 'Fujian'], city: {'- Please select -': ['- Please select -'], 'Fujian': ['Fuzhou', 'Xiamen', 'Quanzhou']}, district: {'- Please select -: ['- Please select -'] Fuzhou: [Gulou District, Taijiang District], Xiamen City: [Huli District, Jimei District], Quanzhou City: [Jinjiang City, Anxi County]}, provinceIndex: 0, cityIndex: 0, districtIndex: 0, selectedProvince:'- Please select -, selectedCity:'- Please select -' SelectedDistrct:'- Please select -'} Function init (that) {that.setData ({'city': city}); var bindProvinceChange = function (e) {var city = that.data.city That.setData ({'city.provinceIndex': e.detail.value,' city.selectedProvince': city.province [e.detail.value], 'city.selectedCity': city.city [city.province [e.detail.value]] [0],' city.selectedDistrct': city.districtcity.city.city.city [e.detail.value]] [0]] 'city.cityIndex': 0,' city.districtIndex': 0}) }; var bindCityChange = function (e) {var city = that.data.city That.setData ({'city.cityIndex': e.detail.value,' city.selectedCity': city.city [city.selectedProvince] [e.detail.value], 'city.districtIndex': 0,' city.selectedDistrct': city.district [city.city.selectedstones] [e.detail.value]] [0]});} Var bindDistrictChange = function (e) {var city = that.data.city; that.setData ({'city.districtIndex': e.detail.value,' city.selectedDistrct': city.district [city.selectedCity] [e.detail.value]});}; that ['bindProvinceChange'] = bindProvinceChange; that [' bindCityChange'] = bindCityChange; that ['bindDistrictChange'] = bindDistrictChange } module.exports = {init: init} after reading this article, I believe you have a certain understanding of "example Analysis of three-level interaction among provinces, cities and regions in Mini Program component Development". If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.