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 小时前
GPUI 在 macOS 上编译问题排查指南
spring boot·后端·macos·小程序·rust·uni-app·web app
码云数智-园园1 天前
uni-app 实现物流进度跟踪功能:从 UI 到数据驱动的完整方案
ui·uni-app
予你@。3 天前
UniApp + Vue3 实现 Tab 点击滚动定位(微信小程序)
微信小程序·小程序·uni-app
游戏开发爱好者83 天前
完整教程:App上架苹果App Store全流程指南
android·ios·小程序·https·uni-app·iphone·webview
予你@。3 天前
uni-app progress 组件使用详解
uni-app
iOS阿玮3 天前
春节提审高峰来袭!App Store 审核时长显著延长。
uni-app·app·apple
2501_916007473 天前
ios上架 App 流程,证书生成、从描述文件创建、打包、安装验证到上传
android·ios·小程序·https·uni-app·iphone·webview
2501_915106324 天前
iPhone 文件管理,如何进行应用沙盒文件查看
android·ios·小程序·https·uni-app·iphone·webview
2501_915921434 天前
Fastlane 结合 AppUploader 来实现 CI 集成自动化上架
android·运维·ci/cd·小程序·uni-app·自动化·iphone
云游云记4 天前
vue2 vue3 uniapp (微信小程序) v-model双向绑定
微信小程序·uni-app·vue