demo.html 1.11 KB
<h4>点击下列链接弹出 - 底部菜单</h4>
<a href="javascript:;" onclick="footerMenu1()">基本用法 - 为每个菜单设置点击回调方法</a>
<a href="javascript:;" onclick="footerMenu2()">进阶用法 - 对菜单点击回调进行统一处理</a>
<style>
h4 { margin: 10px; }
a {
    display: block;
    padding: 5px 16px;
    color: #108ee9;
    text-decoration: underline;
}
</style>
<script>
function footerMenu1() {
    Mobile_NS.footerMenu([{
        text: "菜单一",
        callback: function () {
            Mobile_NS.msg("点击了菜单一");
        }
    }, {
        text: "菜单二",
        callback: function () {
            Mobile_NS.msg("点击了菜单二");
        }
    }, {
        text: "菜单三",
        callback: function () {
            Mobile_NS.msg("点击了菜单三");
        }
    }]);
}

function footerMenu2() {
    Mobile_NS.footerMenu([
        {text: "菜单一"}, 
        {text: "菜单二"}, 
        {text: "菜单三"}
    ], function (menu) {
        var index = parseInt(menu.index);

        Mobile_NS.msg("点击了第" + (index + 1) + "个菜单");
    });
}
</script>