gpt4 book ai didi

javascript - 使用 chagePage 手动传递额外值

转载 作者:行者123 更新时间:2023-11-30 18:31:02 25 4
gpt4 key购买 nike

如何在 jQuery Mobile 中手动将哈希值传递到下一页并在 pagecreate/pageshow 中接收它

我尝试在第 1 页上的按钮被点击时跟随

   $.mobile.changePage('#page2?val=1', { 
transition: 'slideup'
}

);

HTML 页面代码

<html>
<head><title>jQuery Mobile Test</title></head>
<body>
<div id="page1" data-role="page">
<div data-role="header">
<h1>Page 1</h1>
</div>
<div data-role="content">
Place content here
// i tried this too but didnt receive at the pagecreate of pge 1
<a href="#page2?val=1" data-role="button">Send Value</a>

</div>
<div data-role="footer">
<h1>Footer</h1>
</div>
</div>
<div id="page2" data-role="page" data-add-back-btn="true">
<div data-role="header">
<h1>Page 2</h1>
</div>
<div data-role="content">
Place content here
</div>
<div data-role="footer">
<h1>Footer</h1>
</div>
</div>
</body>
</html>

最佳答案

好的,看来jqm不支持这个:

jQuery Mobile does not support query parameter passing to internal/embedded pages.

但是,他们的文档提供了可以帮助您的插件:

There are two plugins that you can add to your project if query parameters are needed between pages. There is a lightweight page params plugin and a more fully featured jQuery Mobile router plugin for use with backbone.js or spine.js.

在此处称为“页面间传递参数”的部分中找到:http://jquerymobile.com/test/docs/pages/page-scripting.html

关于javascript - 使用 chagePage 手动传递额外值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9619812/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com