要使用 layer.open 实现 Layui 页面跳转,请按以下步骤操作:引入 JavaScript 文件。创建页面跳转函数。调用函数并传入 URL。

使用 layer.open 实现 Layui 页面跳转
如何使用 layer.open 实现 Layui 页面跳转?
要使用 layer.open 实现 Layui 页面跳转,请按照以下步骤操作:
1. 引入必要的 JavaScript 文件
<code class="html"><script src="https://cdn.layui.com/layui/layui.js"></script></code>
2. 创建页面跳转函数
<code class="javascript">function pageJump(url) {
layui.layer.open({
type: 2,
title: '页面跳转',
content: url,
area: ['800px', '600px'],
maxmin: true
});
}</code>3. 调用函数并传入 URL
<code class="html"><button onclick="pageJump('page_example.html')">跳转到示例页面</button></code>详细介绍:
layui.layer.open 函数用于打开一个弹层。type: 2 指定弹层类型为 iframe。content 指定弹层内容的 URL。area 指定弹层的大小。maxmin 允许弹层最大化和最小化。当单击按钮时,pageJump() 函数将被调用,并传入示例页面的 URL。此 URL 将加载到弹层中,从而实现页面跳转。
以上就是使用 layer.open 实现 Layui 页面跳转的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号