插入列表块(Inset List Block)

优质
小牛编辑
132浏览
2023-12-01

描述 (Description)

通过向list-block添加inset类, list-block块可以具有inset样式。

例子 (Example)

下面的示例演示了使用inset即使在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>Grouped Lists</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 = "pages">
               <div data-page = "home" class = "page navbar-fixed">
                  <div class = "navbar">
                     <div class = "navbar-inner">
                        <div class = "left"> </div>
                        <div class = "center">List View Inset</div>
                        <div class = "right"> </div>
                     </div>
                  </div>
                  <div class = "page-content">
                     <div class = "content-block-title">Fullwidth block</div>
                     <div class = "list-block">
                        <ul>
                           <li class = "item-content">
                              <div class = "item-inner">
                                 <div class = "item-title">Item 1</div>
                              </div>
                           </li>
                           <li class = "item-content">
                              <div class = "item-inner">
                                 <div class = "item-title">Item 2</div>
                              </div>
                           </li>
                           <li class = "item-content">
                              <div class = "item-inner">
                                 <div class = "item-title">Item 3</div>
                              </div>
                           </li>
                        </ul>
                     </div>
                     <div class = "content-block-title">Inset list block</div>
                     <div class = "list-block inset">
                        <ul>
                           <li class = "item-content">
                              <div class = "item-media"><i class = "icon icon-form-name"></i></div>
                              <div class = "item-inner">
                                 <div class = "item-title">Item 1</div>
                                 <div class = "item-after">Label 1</div>
                              </div>
                           </li>
                           <li class = "item-content">
                              <div class = "item-media"><i class = "icon icon-form-name"></i></div>
                              <div class = "item-inner">
                                 <div class = "item-title">Item 2 with badge</div>
                                 <div class = "item-after"> <span class = "badge">78</span></div>
                              </div>
                           </li>
                           <li class = "item-content">
                              <div class = "item-media"><i class = "icon icon-form-name"></i></div>
                              <div class = "item-inner">
                                 <div class = "item-title">Item 3</div>
                                 <div class = "item-after">Label 2</div>
                              </div>
                           </li>
                        </ul>
                        <div class = "list-block-label">List block label text written here</div>
                     </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>
         var myApp = new Framework7();
      </script>
   </body>
</html>

输出 (Output)

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

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

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

  • 此示例使用inset类删除列表块的全宽样式。