• uniapp制作h5小程序中双列下拉查询


    uniapp制作h5小程序中双列下拉查询
    在这里插入图片描述

    	<view class="cu-form-group">
    					<view class="title">地址</view>
    					<picker mode="multiSelector" @change="MultiChange" @columnchange="MultiColumnChange"
    						:value="multiIndex" :range="multiArray">
    						<view class="picker" v-if="multiArray[0] && istrue == true">
    							{{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}}
    						</view>
    						<view class="picker" v-else>
    							请选择地址
    						</view>
    					</picker>
    				</view>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    data:
    	// ---------
    				multiArray: [],
    				firstnoe: "",
    				firPull: [],
    				secPull: [],
    				multiIndex: [0, 0],
    				istrue: false,
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    	onShow() {
    			this.getevent()
    		},
    	// --------
    			MultiChange(e) {
    				console.log(3)
    				// 选择了
    				this.istrue = true
    				this.multiIndex = e.detail.value
    				this.submit.place = this.secPull[this.multiIndex[1]].name
    				console.log(this.submit.place)
    			},
    			async MultiColumnChange(e) {
    				let data = {
    					multiArray: this.multiArray,
    					multiIndex: this.multiIndex
    				};
    				data.multiIndex[e.detail.column] = e.detail.value;
    				this.tourName = this.firPull[data.multiIndex[0]]
    				await this.getTower_name(this.firPull[data.multiIndex[0]])
    				this.multiArray = data.multiArray;
    				this.multiIndex = data.multiIndex;
    				console.log(this.multiArray)
    				this.$forceUpdate()
    
    			},
    				// 根据楼层获取展厅
    			async getTower_name(name) {
    				var arr = []
    				var that = this
    				await $api.getTower_name({
    					tower: name
    				}).then(res => {
    					that.secPull = res.content
    					res.content.forEach(item => {
    						arr.push(item.name)
    						// this.$set(this.multiArray[1],this.multiArray[1],arr);
    					})
    					that.multiArray[1] = arr
    				})
    
    				return arr
    			},
    				getevent() {
    				$api.geteventType().then(res => {
    					console.log(res)
    					this.examinationTypeArray = res.data
    					// 设定一个默认事件
    					if (this.examinationTypeArray.length != 0) {
    						this.examinationTypeIndex = 0;
    						this.examinationTypeArrayType = this.examinationTypeArray[this.examinationTypeIndex]
    							.typeName
    						this.submit.eventType = this.examinationTypeArray[this.examinationTypeIndex].id
    					}
    
    				})
    
    			},
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
  • 相关阅读:
    javacc之路4---错误恢复
    Spark---核心概念(Spark,RDD,Spark的核心构成组件)详解
    中小企业数字化的“下半场”,与华为的生态伙伴“引力场”
    PASSWORD_VERIFY_FUNCTION 值 FROM ROOT 与default 的差异
    对齐PyTorch,一文详解OneFlow的DataLoader实现
    【复杂网络】网络的规律性研究笔记
    高速电路设计----第三章
    半解析快速傅里叶变换
    docker容器操作
    python使用requests实现发送带文件请求
  • 原文地址:https://blog.csdn.net/Fairyasd/article/details/125502622