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即可

相关推荐
于先生吖9 小时前
前后端分离二手商城开发,质检登记、回收回款整套业务源码部署教程
java·开发语言·uni-app
Geek_Vison15 小时前
政务一网通APP如何引入AI能力,通过一个AI助手就能够调用所有的功能,实现对话即办事
人工智能·ai·小程序·uni-app·小程序容器
狗凯之家源码网2 天前
UniApp 数藏系统源码部署与定制开发全指南
uni-app
RuoyiOffice3 天前
2026 企业定制开发选型:从零开发、低代码、SaaS 与 RuoYi Office 怎么选?
spring boot·uni-app·开源·saas·oa·定制化·ruoyioffice
三天不学习3 天前
【超详细】Vue3+UniApp+.NET8集成腾讯云IM即时通信全攻略
uni-app·.net·腾讯云·im·即时通信
于先生吖3 天前
前后端分离人事招聘项目,校招宣讲预约+社招双向撮合功能架构设计教程
java·开发语言·uni-app
QQ_5110082853 天前
uniapp微信小程序网上饰品商城售卖系统php python物流
微信小程序·uni-app·php
2501_915909063 天前
深入解析Mock.js:功能、应用及实战案例,提升前端开发效率
android·ios·小程序·https·uni-app·iphone·webview
于先生吖3 天前
前后端分离体育服务项目,场馆计费+线下赛事排行小程序部署开发教程
java·小程序·uni-app
蜡台3 天前
Uniapp 实现预览pdf 文件
pdf·uni-app·pdfh5