data-url属性在jquery mobile中做了什么? [英] What does the data-url attribute do in jquery mobile?
问题描述
试图找出页面的基本结构,并遇到了一个具有 data-url
属性的博客。这究竟是什么意思?
Trying to figure out the basic structure of a page and came across a blog that had the data-url
attribute. What exactly does this mean?
推荐答案
该属性用于识别jQM自动生成的页面。来自 jQM docs :
That attribute serves to identify pages that are auto-generated by jQM. From the jQM docs:
...
插件自动生成的页面使用以下特殊的
data-url结构:< div
data -url =page.html& subpageidentifier>
...Pages that are auto-generated by plugins use the following special data-url structure: <div data-url="page.html&subpageidentifier">
因此,例如,
生成的页面listview插件可能有
data-url属性如下:
data-url =artists.html& ui-page = listview-1
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"
当请求页面时,jQuery
Mobile知道将URL拆分为
& ui-page,并在
键之前向URL
发出HTTP请求。对于上面提到的listview
示例,URL
看起来像这样:
http://example.com/artists.html&ui-page=listview-1
...和jQuery Mobile会请求
artists.html,这将是然后
生成其子页面,使用
data-url =artists.html& ui-page = listview-1创建
div,
然后显示作为
活动页面。
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.
注意
的data-url属性元素包含完整的URL
路径,而不仅仅是
& ui-page =之后的部分。这允许jQuery Mobile
使用单个一致的机制
匹配URL到页面data-url
属性。
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.
这篇关于data-url属性在jquery mobile中做了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!