• mui实现下拉刷新以及click事件无法响应问题


    直接上干货

    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/jquery")
        @Scripts.Render("~/bundles/mui")
        <script type="text/javascript">
              var hostBaseUrl="@Url.Content("~")";
        </script>
    </head>
    <body>
        @if (ViewBag.NavStyle == "NavStyle_01")
        {
            <!--图片背景-->
            <header class="mui-bar mui-bar-nav y-bar-nav">
                <a class="mui-action-back mui-pull-left y-bar-nav-left" onclick="javascript:history.back(-1);">
                    <img src="~/Content/images/left.png" />
                </a>
                <h1 class="mui-title">@ViewBag.Title</h1>
                <a class="mui-action-back mui-pull-right y-bar-nav-right">
                    <div>
                        <img src="~/Content/images/more.png" />
                        <img src="~/Content/images//close.png" />
                    </div>
                </a>
            </header>
        }
        else
        {
            <!--纯色背景-->
            <header class="mui-bar mui-bar-nav y-bar-nav-01">
                <a class="mui-action-back mui-pull-left y-bar-nav-left" onclick="javascript:history.back(-1);">
                    <img src="~/Content/images/left.png" />
                </a>
                <h1 class="mui-title">@ViewBag.Title</h1>
                <a class="mui-action-back mui-pull-right y-bar-nav-right">
                    <img src="~/Content/images/more.png" style="margin-top:22px" />
                </a>
            </header>
        }
        <div id="pullrefresh" class="mui-content mui-scroll-wrapper">
            <div class="mui-scroll">
                @RenderBody()
            </div>
        </div>
    
        <script>
            mui.init({
                pullRefresh: {
                    container: '#pullrefresh',
                    down: {
                        style: 'circle',
                        callback: pulldownRefresh
                    }
                }
            });
            /**
             * 下拉刷新具体业务实现
             */
            function pulldownRefresh() {
                setTimeout(function () {
                    var url = location.href;
                    if (url.indexOf("&time=") != -1) {
                        window.location.href = location.href.split("&time=")[0] + "&time=" + ((new Date()).getTime());
                    }
                    else {
                        window.location.href = location.href.split("?time=")[0] + "?time=" + ((new Date()).getTime());
                    }
                    mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
                }, 2000);
            }
            /**
            * 这很重要!!!mui框架下拉刷新上拉加载,click事件无效的解决方法
            */
            mui("#pullrefresh").on("tap", "div,button", function (event) {
                this.click();
            });
        </script>
        @RenderSection("scripts", required: false)
    </body>
    </html>
  • 相关阅读:
    为VMware虚拟机内安装的Ubuntu 16.04设置静态IP地址
    WPF入门教程系列二十三——DataGrid示例(三)
    WPF入门教程系列二十一——DataGrid示例(二)
    Google Nexus 5X刷机并root
    web调用摄像头拍照
    导出SQL SERVER 数据字典语句
    树莓派安装.Net Core3.1
    使用Open Live Writer写博客
    EFCore的外键级联删除导致的【可能会导致循环或多重级联路径】
    重新装Mysql数据的恢复办法,还原data文件夹下数据库
  • 原文地址:https://www.cnblogs.com/yechangzhong-826217795/p/14011131.html
Copyright © 2020-2023  润新知