Framework7 - 在弹出窗口中打开
说明
通过使用 popup 的 data-open-in 属性,可以将智能选择作为弹出窗口打开。
示例
以下示例演示了在 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>Open in Popup</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 = "left"> </div>
<div class = "center sliding">Smart Select Open in Popup</div>
<div class = "right"> </div>
</div>
</div>
<div class = "pages navbar-through">
<div data-page = "home" class = "page">
<div class = "page-content">
<div class = "list-block">
<ul>
<li>
<a href = "#" data-open-in = "popup" class = "item-link smart-select">
<select name = "countries">
<option value = "India" selected>India</option>
<option value = "Newz = Zealnad">New Zealand</option>
<option value = "Srilanka">Srilanka</option>
<option value = "WestIndies">West Indies</option>
<option value = "China">China</option>
</select>
<div class = "item-content">
<div class = "item-inner">
<div class = "item-title">Countries</div>
</div>
</div>
</a>
</li>
<li>
<a href = "#" data-open-in = "popup" data-popup-close-text = "Close the List" class = "item-link smart-select">
<select name = "sports">
<option value = "Cricket">Cricket</option>
<option value = "Hockey">Hockey</option>
<option value = "Football">Football</option>
<option value = "Volleyball" selected>Volleyball</option>
<option value = "Rugby">Rugby</option>
</select>
<div class = "item-content">
<div class = "item-inner">
<div class = "item-title">Sports</div>
</div>
</div>
</a>
</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 ({
animateNavBackIcon:true
});
// 如果您使用自定义 DOM 库,则将其保存到 $$ 变量
var $$ = Dom7;
// 添加视图
var mainView = myApp.addView('.view-main', {
// 为该视图启用动态导航栏
dynamicNavbar: true
});
</script>
</body>
</html>
输出
让我们执行以下步骤来查看上述代码的工作原理 −
将上述 HTML 代码保存为服务器根文件夹中的 smart_select_popup.html 文件。
将此 HTML 文件作为 http://localhost/smart_select_popup.html 打开,输出显示如下。
输出显示使用 data-open-in 属性将智能选择作为弹出窗口打开。
当您单击列表中的任何一个选项时,它会链接到一个弹出窗口,其中包含另一个列表以及页面标题,您只能从列表中选择一个选项。

framework7_forms.html