layui 高度不能自适应 请教大佬 大佬!!!在线急

81 阅读1分钟

想了很多都没有解决问题

image.png 这里修改成height500px 他是可以显示的 但是 height:auto 就不显示
这是 他step 的配置

//  步骤条配置
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: 'auto',
        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);
    }
});