目录

Indicator

描述 (Description)

指标模态指定小指示活动,如用户操作的预加载模式。 它使用以下方法 -

  • showIndicator - 用于显示带指示器的模态。

  • hideIndicator - 用于隐藏带指示符的模态。

例子 (Example)

以下示例演示了Framework7中指示器模态的使用,它在您单击链接时显示小指示活动 -

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1, 
         maximum-scale = 1, minimum-scale = 1, user-scalable = no, minimal-ui" />
      <meta name = "apple-mobile-web-app-capable" content = "yes" />
      <meta name = "apple-mobile-web-app-status-bar-style" content = "black" />
      <title>Indicator Modal</title>
      <link rel = "stylesheet" 
         href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.min.css" />
      <link rel = "stylesheet" 
         href = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/css/framework7.ios.colors.min.css" />
   </head>
   <body>
      <div class = "views">
         <div class = "view view-main">
            <div class = "navbar">
               <div class = "navbar-inner">
                  <div class = "center sliding">Indicator Modal</div>
               </div>
            </div>
            <div class = "pages">
               <div data-page = "index" class = "page navbar-fixed">
                  <div class = "page-content">
                     <div class = "content-block">
                        <p><a href = "#" class = "indicator_modal">Display the Indicator</a></p>
                     </div>
                  </div>
               </div>
            </div>
         </div>
      </div>
      <script type = "text/javascript" 
         src = "https://cdnjs.cloudflare.com/ajax/libs/framework7/1.4.2/js/framework7.min.js"></script>
      <script>
         // Here you can initialize the app
         var myApp = new Framework7();
         // If your using custom DOM library, then save it to $$ variable
         var $$ = Dom7;
         // Add the view
         var mainView = myApp.addView('.view-main', {
            // enable the dynamic navbar for this view:
            dynamicNavbar: true
         });
         $$('.indicator_modal').on('click', function () {
            myApp.showIndicator();
            setTimeout(function () {
               myApp.hideIndicator();
            }, 1500);
         });
      </script>
   </body>
</html>

输出 (Output)

让我们执行以下步骤,看看上面给出的代码是如何工作的 -

  • 将上面给出的HTML代码保存为服务器根文件夹中的modal_indicator.html文件。

  • 以http://localhost/modal_indicator.html打开此HTML文件,输出显示如下。

  • 当用户单击“显示指示器”选项时,指示器模态显示指示活动,如预加载器。

新页面打开
↑回到顶部↑
WIKI教程 @2018