uniapp 里折叠面板嵌套 uni-collapse 高度不能自适应解决办法

cpp 复制代码
<uni-collapse accordion v-model="accordionVal" @change="changeCollapse" ref="collapse">

					<uni-collapse-item :title="index+1+'、'+item.productTitle" v-for="(item,index) in listData"
						:key="index">
						<view class="content">
							<view class="text w100 gradeLi" v-for="(items,indexs) in item.children" :key="index+indexs" >
								<view class="gradeLiTitle">{{index+1}}.{{indexs+1}}.{{items.gradeName}}</view>
								<view class="gradeLiHg mt-2 flex">

									<uni-data-checkbox @change="handleSelectHg($event,index,indexs)"
										v-model="data.listData[index].children[indexs].checked"
										 :localdata="items.children" ></uni-data-checkbox>

								</view>
								<!-- 选择了不符合 -->
								<view class="gradeLiHgNo w100 mt-2"
									v-if="data.listData[index].children[indexs].checked==0">

									<uni-easyinput type="textarea"
										v-model="data.listData[index].children[indexs].wrongDescription"
										placeholder="请输入不符合说明" />

									<view class="w100 mt-2">
										<uni-easyinput class="" type="textarea"
											v-model="data.listData[index].children[indexs].rectificationMeasures"
											placeholder="请输入整改措施" />

									</view>


									<view class="w100 mt-2">
										<uni-easyinput v-model="data.listData[index].children[indexs].responsiblePerson"
											placeholder="责任人" />
									</view>
									<view class="mt-2">
										<my-upload-image
											v-model="data.listData[index].children[indexs].supportingMaterials"
											:limit="5" :index="index" :indexs="indexs"
											@dataToParent="handleDataFromChild"></my-upload-image>

									</view>
								</view>



							</view>
						</view>
					</uni-collapse-item>

				</uni-collapse>
cpp 复制代码
	import {
		ref,
		onMounted,
		reactive,
		getCurrentInstance,
		onBeforeMount,
		toRefs
	} from 'vue'
	
	const {
		proxy
	} = getCurrentInstance();
cpp 复制代码
	//选择符号不符合
	const handleSelectHg = ((e, index, indexs) => {

		data.listData[index].children[indexs].checked = e.detail.value;

		console.log("您选择了", data.listData[index].children[indexs].checked)
		// 选择了不符号之后去延时刷新高度
		handleHeight();
	})

	//解决超出不显示问题
	const handleHeight=(() => {
		proxy.$nextTick(() => {
			setTimeout(() => {
				console.log("1233")
				proxy.$refs.collapse.resize();
			}, 100)
		});
	})

这是一个巨坑

如果是vue2.0 把proxy改为this即可

相关推荐
计算机学姐8 小时前
基于微信小程序的校园失物招领管理系统【uniapp+springboot+vue】
java·vue.js·spring boot·mysql·信息可视化·微信小程序·uni-app
2501_915921439 小时前
HTTPS前端劫持 新一代流量劫持解决方案
前端·网络协议·ios·小程序·https·uni-app·iphone
爱怪笑的小杰杰9 小时前
优化 UniApp 日历组件的多语言切换:告别 setLocale 引起的 App 重启
java·前端·uni-app
计算机学姐11 小时前
基于微信小程序的宠物服务系统【uniapp+springboot+vue】
java·vue.js·spring boot·mysql·微信小程序·uni-app·宠物
2501_9159090611 小时前
iOS应用签名的三种方法全解析:从官方到第三方工具
android·ios·小程序·https·uni-app·iphone·webview
心中无石马1 天前
uniapp引入tailwindcss4.x
前端·css·uni-app
fix一个write十个1 天前
【uniApp开发】微信小程序 web-view 内嵌 H5 跳转支付踩坑实录
微信小程序·uni-app
wuxianda10301 天前
苹果App上架4.3a被拒解决方案汇报总结
ios·uni-app·objective-c·cocoa·苹果上架·4.3a
西洼工作室1 天前
uniapp+vue3+python对接阿里云短信认证服务alibabacloud_dypnsapi20170525
python·阿里云·uni-app
wuxianda10301 天前
苹果App上架4.3a问题3天解决方案汇报总结
开发语言·javascript·uni-app·ecmascript·ios上架·苹果上架