pear-admin-layui-main 4.0 tabPage.js 优化点击切换刷新iframe

    tabPage.prototype.click = function (callback) {
        var option = this.option;
        var elem = this.option.elem;
        element.on('tab(' + this.option.elem + ')', function (data) {
            var id = $("#" + elem + " .layui-tab-title .layui-this").attr("lay-id");
            sessionStorage.setItem(option.elem + "-pear-tab-page-data-current", id);

            // 检查iframe 找到后刷新他
            var iframe = $('.layui-tab-item.layui-show iframe#' + id);
            if (iframe.length) {                
                iframe.attr('src', iframe.attr('src'));// 刷新
                console.log('已刷新' + iframe.attr('src'));
            } else {
                console.log('未找到指定的 iframe');
            }
            //callback(id);
        });
    }

 

posted @ 2024-10-18 23:32  懒人境界  阅读(18)  评论(0编辑  收藏  举报