List block
优质
小牛编辑
131浏览
2023-12-01
描述 (Description)
list block是列表视图元素包装器,它使用list-block类。 它几乎与content block类似,但对于列表元素。 所有列表视图元素必须用list-block元素包装,如下所示 -
<div class = "list-block">
<ul>
... list elements here ...
</ul>
</div>
列表块标签
list block label可以添加到列表块的末尾,如下所示 -
<div class = "list-block">
<ul>
... list elements here ...
</ul>
<div class = "list-block-label">List block label text</div>
</div>
List item/element
灵活的单一列表元素布局如下所示 -
<li>
<div class = "item-content"> <!-- It is Required and is the main flex wrapper. -->
<div class = "item-media"> <!-- Is optional element and is the container for media elements. -->
<i class = "icon my-icon"></i>
</div>
<div class = "item-inner"> <!-- It is Required and is the main flex wrapper for item-title and item-after. -->
<div class = "item-title"> <!-- Required and is a single-line list item title -->
List element title
</div>
<div class = "item-after"> <!-- List item label. Can contain label text, badge, switch or button, etc.-->
List element label
</div>
</div>
</div>
</li>
例子 (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>Swipe Panel</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</div>
<div class = "right"> </div>
</div>
</div>
<div class = "page-content">
<div class = "content-block-title">Full Layout</div>
<div class = "list-block">
<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 title</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 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">Another item</div>
<div class = "item-after">Another label</div>
</div>
</li>
</ul>
<div class = "list-block-label">List block label text is written here</div>
</div>
<div class = "content-block-title">Only titles</div>
<div class = "list-block">
<ul>
<li class = "item-content">
<div class = "item-inner">
<div class = "item-title">Item title</div>
</div>
</li>
<li class = "item-content">
<div class = "item-inner">
<div class = "item-title">Item with badge</div>
</div>
</li>
<li class = "item-content">
<div class = "item-inner">
<div class = "item-title">Another item</div>
</div>
</li>
</ul>
</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_list_block.html文件。
以http://localhost/list_views_list_block.html打开此HTML文件,输出显示如下。
该示例显示列表元素的列表视图元素包装器,其类似于内容块。