gpt4 book ai didi

javascript - data-url 属性在 jquery mobile 中有什么作用?

转载 作者:太空狗 更新时间:2023-10-29 13:44:55 25 4
gpt4 key购买 nike

试图弄清楚页面的基本结构并遇到一个具有 data-url 属性的博客。这到底是什么意思?

最佳答案

该属性用于标识由 jQM 自动生成的页面。来自 jQM docs :

...Pages that are auto-generated by plugins use the following special data-url structure: <div data-url="page.html&subpageidentifier">

So, for example, a page generated by the listview plugin may have an data-url attribute like this: data-url="artists.html&ui-page=listview-1"

When a page is requested, jQuery Mobile knows to split the URL at "&ui-page" and make an HTTP request to the portion of the URL before that key. In the case of the listview example mentioned above, the URL would look like this: http://example.com/artists.html&ui-page=listview-1 ...and jQuery Mobile would request artists.html, which would then generate its sub-pages, creating the div with data-url="artists.html&ui-page=listview-1", which it will then display as the active page.

Note that the data-url attribute of the element contains the full URL path, not just the portion after &ui-page=. This allows jQuery Mobile to use a single consistent mechanism that matches URLs to page data-url attributes.

关于javascript - data-url 属性在 jquery mobile 中有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5917111/

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