Grouped Lists
优质
小牛编辑
128浏览
2023-12-01
描述 (Description)
您可以将列表视图元素包装在单个列表块中。
例子 (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>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 Groups</div>
<div class = "right"> </div>
</div>
</div>
<div class = "page-content">
<div class = "list-block">
<div class = "list-group">
<ul>
<li class = "list-group-title">First group</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 title 1</div>
<div class = "item-after">Label</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 1 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 title 2</div>
<div class = "item-after">Label</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</div>
</div>
</li>
</ul>
</div>
<div class = "list-group">
<ul>
<li class = "list-group-title">Second group</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 title 1</div>
<div class = "item-after">Label</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 1 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 title 2</div>
<div class = "item-after">Label</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</div>
</div>
</li>
</ul>
</div>
</div>
<div class = "content-block">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras condimentum
molestie diam eu rhoncus. Aliquam a accumsan felis. Morbi magna ipsum, pellentesque
vitae diam mattis, cursus pellentesque lorem. Curabitur orci tortor, feugiat
nec erat non, iaculis iaculis nisi.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras condimentum
molestie diam eu rhoncus. Aliquam a accumsan felis. Morbi magna ipsum, pellentesque
vitae diam mattis, cursus pellentesque lorem. Curabitur orci tortor, feugiat nec erat
non, iaculis iaculis nisi.</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>
var myApp = new Framework7();
</script>
</body>
</html>
输出 (Output)
让我们执行以下步骤,看看上面给出的代码是如何工作的 -
将上面给出的HTML代码保存为服务器根文件夹中的list_views_grouped_lists.html文件。
以http://localhost/list_views_grouped_lists.html打开此HTML文件,输出显示如下。
此代码将列表视图元素分组到单个列表块中。