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

相关推荐
程序鉴定师10 小时前
2026年深圳小程序/App开发公司技术选型指南:从架构设计到交付标准全维度评估
java·小程序·uni-app·php·objective-c
Q264336502311 小时前
【有源码】基于uni-app的旅游行程规划小程序-基于微信小程序的智慧文旅综合服务平台
java·微信小程序·小程序·uni-app·毕业设计·springboot·源代码
qq_316837751 天前
阿里云百炼 fun-asr-realtime uniapp vue3 调用
javascript·vue.js·uni-app
特创数字科技1 天前
uniapp 图片全能处理|全平台支持(鸿蒙、安卓、苹果、web),实现九宫格、水印、滤镜、压缩、拼图
uni-app
2501_916007471 天前
苹果应用商店App Store上架费用标准及原因解析
android·ios·小程序·https·uni-app·iphone·webview
00后程序员张2 天前
苹果App Store上架指南:费用、原理与步骤详解
android·ios·小程序·https·uni-app·iphone·webview
特创数字科技2 天前
【uni-app x】告别系统相机限制!三端通用自定义相机组件:任意布局、静默拍照、录像、水印叠加、连拍回图一次搞定
前端·数码相机·uni-app
Martin -Tang3 天前
uniapp app嵌套webview 弹窗方式
android·ios·uni-app
郑州光合科技余经理3 天前
同城电商系统:库存变更怎么同步到订单
java·开发语言·前端·后端·uni-app·php·ai编程
CHB4 天前
一文讲透原生渲染和自渲染
flutter·react native·uni-app