帖子
帖子
用户
博客
课程
显示全部楼层
88
帖子
0
勋章
710
Y币

[开发工具] frame和group的问题

[复制链接]
发表于 2022-4-20 16:25:51

<script type="text/javascript">
    apiready = function () {

        $api.fixStatusBar($api.dom('header'));
        $api.fixStatusBar($api.dom('main'));
        api.setStatusBarStyle({
            style: 'dark',
            color: '#6ab494'
        });
        funIniGroup();

    }

    function funIniGroup() {
        var eHeaderLis = $api.domAll('header li'),
            frames = [];
        for (var i = 0, len = eHeaderLis.length; i < len; i++) {
            frames.push({
                name: 'frame' + i,
                url: 'frame' + i + '.html',
                bgColor: 'rgba(0,0,0,.5)',
                bounces: true,
                useWKWebView:true,
                allowAccessFromFile:true,
                historyGestureEnabled:true,
                allowEdit:true,
                syncCookie:true,

            })
        }
        api.openFrameGroup({
            name: 'group',
            scrollEnabled: false,
            rect: {
                x: 0,
                y: $api.dom('header').offsetHeight,
                w: api.winWidth,
                h: $api.dom('#main').offsetHeight
            },
            index: 0,
            frames: frames
        }, function (ret, err) {

        });
    }

    // 随意切换按钮
    function randomSwitchBtn(tag) {
        if (tag == $api.dom('#footer li.active')) return;
        var eFootLis = $api.domAll('#footer li'),
            eHeaderLis = $api.domAll('header li'),
            index = 0;
        for (var i = 0, len = eFootLis.length; i < len; i++) {
            if (tag == eFootLis[i]) {
                index = i;
            } else {
                $api.removeCls(eFootLis[i], 'active');
                $api.removeCls(eHeaderLis[i], 'active');
            }
        }
        $api.addCls(eFootLis[index], 'active');
        $api.addCls(eHeaderLis[index], 'active');
        api.setFrameGroupIndex({
            name: 'group',
            index: index
        });
    }

    function back() {
        api.historyBack({
        }, function (ret, err) {
            if (!ret.status) {
                api.closeWin();
            }
        });
    }
</script>



main.html 里面 <div id="main" class="flex-con" style="z-index: 999;">的内容被frame覆盖掉了。

<script src="../script/jquery-3.5.1.min.js"></script>
<script type="text/javascript">
    apiready = function () {

        $api.fixStatusBar($api.dom('header'));
        $show('main');
        api.setStatusBarStyle({
            style: 'dark',
            color: '#6ab494'
        });
        funIniGroup();

    }

    function funIniGroup() {
        var eHeaderLis = $api.domAll('header li'),
            frames = [];
        for (var i = 0, len = eHeaderLis.length; i < len; i++) {
            frames.push({
                name: 'frame' + i,
                url: 'frame' + i + '.html',
                bgColor: 'rgba(0,0,0,.5)',
                bounces: true,
                useWKWebView:true,
                allowAccessFromFile:true,
                historyGestureEnabled:true,
                allowEdit:true,
                syncCookie:true,

            })
        }
        api.openFrameGroup({
            name: 'group',
            scrollEnabled: false,
            rect: {
                x: 0,
                y: $api.dom('header').offsetHeight,
                w: api.winWidth,
                h: $api.dom('#main').offsetHeight
            },
            index: 0,
            frames: frames
        }, function (ret, err) {

        });
    }

    // 随意切换按钮
    function randomSwitchBtn(tag) {
        if (tag == $api.dom('#footer li.active')) return;
        var eFootLis = $api.domAll('#footer li'),
            eHeaderLis = $api.domAll('header li'),
            index = 0;
        for (var i = 0, len = eFootLis.length; i < len; i++) {
            if (tag == eFootLis[i]) {
                index = i;
            } else {
                $api.removeCls(eFootLis[i], 'active');
                $api.removeCls(eHeaderLis[i], 'active');
            }
        }
        $api.addCls(eFootLis[index], 'active');
        $api.addCls(eHeaderLis[index], 'active');
        api.setFrameGroupIndex({
            name: 'group',
            index: index
        });
    }

    function back() {
        api.historyBack({
        }, function (ret, err) {
            if (!ret.status) {
                api.closeWin();
            }
        });
    }
</script>
这样显示了main.html 里面 <div id="main" class="flex-con" style="z-index: 999;">的内容,但frame的内容却没有了,而且还报错了[2022-4-20 16:23:29][ERROR] Uncaught ReferenceError: $show is not defined at main.html:261
请问大佬要怎样修改代码?回答的正确有奖励。





625fc11ea4ba7.png
625fc11ee92ea.png
625fc15453cbc.png
625fc2e9483e7.png
625fc3130c244.png
有啥奖励
88
帖子
0
勋章
710
Y币
给你10个Y币
88
帖子
0
勋章
710
Y币
早知道就不提了,到底该怎么写?
88
帖子
0
勋章
710
Y币
这个平台究竟有没有靠谱的人
问题解决了吗,有新问题,再发个帖子
88
帖子
0
勋章
710
Y币
没有解决
特特法爷 · 2022-5-7 11:04问题解决了吗,有新问题,再发个帖子
您需要登录后才可以回帖 登录

本版积分规则