如果父div 没法设置height(因为是步骤表单,里面的内容高度是不确定的,有的比如500px,有点是动态的1000到1500px之间),然后里面的步骤表单又必须设置height 比如layui.step那个 如果组件设置height:100%的话又不显示(除非设置父类div高度),设置auto的话也是不显示
如解决问题,必有偿 。困扰了好多天了

这个
// 步骤条配置
layui.config({
base: './step-lay/'
}).use(['form', 'step'], function ()
{
var $ = layui.$,
form = layui.form,
step = layui.step;
// 获取 URL 参数中的当前步骤索引值
var urlParams = new URLSearchParams(window.location.search);
var currentStep = parseInt(urlParams.get('step')) || 0;
step.render({
elem: '#stepForm',
filter: 'stepForm',
width: '100%',
stepWidth: '92%',
height: '100%',
stepItems: [
{title: '阅读须知'},
{title: '填写信息'},
{title: '上传材料'},
{title: '结果领取'},
{title: '申请成功'}
],
// 设置当前步骤
step: currentStep,
// 监听步骤切换事件
stepChange: function (currentStepIndex) {
// 更新 URL 参数中的当前步骤索引值
updateUrlParams(currentStepIndex);
}
});
form.on('submit(formStep)', function (data) {
step.next('#stepForm');
return false;
});
form.on('submit(formStep2)', function (data) {
step.next('#stepForm');
return false;
});
$('.pre').click(function () {
step.pre('#stepForm');
});
$('.next').click(function () {
step.next('#stepForm');
});
// 更新 URL 参数中的当前步骤索引值
function updateUrlParams(currentStepIndex) {
var url = new URL(window.location.href);
url.searchParams.set('step', currentStepIndex.toString());
var newUrl = url.toString();
window.history.replaceState({path: newUrl}, '', newUrl);
}
});