简体   繁体   English

Dojo转换到同一项目中的另一个html文件

[英]Dojo transition to another html file in same project

I am using Dojo 1.7. 我正在使用Dojo 1.7。 to implement a Android mobile App with Phonegap. 使用Phonegap实施Android移动应用。 Well my problem is, that I have implemented a tabbar in index.html in my project. 好吧,我的问题是,我在项目的index.html中实现了一个标签栏。 Now I want to make a transition by clicking on a tabbar-icon from index.html to a view-div (called testdiv) of view2.html which is another html file in the same project. 现在,我想通过单击选项卡图标从index.html过渡到view2.html的view-div(称为testdiv),该view2.html是同一项目中的另一个html文件。

Use the url property available within the data-dojo-prop attribute as shown below - 使用data-dojo-prop属性中可用的url属性,如下所示-

Index.html - link to view on another page Index.html-链接以在另一页上查看

<div id="detailsHeading" data-dojo-type="dojox.mobile.Heading"
        data-dojo-props="fixed: 'top', label: 'Details', back:'Back', moveTo:'view1', transition:'slide', transitionDir:'-1',url:'sample.html'">
</div>

The url property above contains the name of the html to be referened and moveTo contains the view to be displayed (your another html may have multiple views) 上面的url属性包含要引用的html的名称,moveTo包含要显示的视图(您的另一个html可能具有多个视图)

Sample.html - view definition Sample.html-视图定义

<div data-dojo-type="dojox.mobile.ScrollableView" id="view1"
    data-dojo-props="selected:false,scrollDir:'v'">
</div>

When the "detailsHeading" is clicked, the application will load sample.html and render the view - view1 单击“ detailsHeading”时,应用程序将加载sample.html并呈现视图-view1

theres not a lot to go by here; 这里没有太多可去的地方; but im nearly a 100% sure that the 'tabbar' you speak of a dojox.mobile.TabBar? 但是我几乎100%确信您所说的'tabbar'是dojox.mobile.TabBar吗?

If so, there's no support out-the-box for pulling in remote pages but you can do this by adding a dijit.layout.ContentPane to the tabbar. 如果是这样,则不存在支持拉入远程页面的现成支持,但是您可以通过在选项卡栏中添加dijit.layout.ContentPane来实现。

Try out this code for your project, each pane loads viewX.html 尝试为您的项目使用此代码,每个窗格加载viewX.html

<div id="groupview1" data-dojo-type="dojox.mobile.View"
       data-dojo-props='selected:true'>
  <ul data-dojo-type="dojox.mobile.TabBar"
       data-dojo-props='barType:"segmentedControl", fixed:"top"'>
    <li data-dojo-type="dojox.mobile.TabBarButton"
        data-dojo-props='moveTo:"subview1", selected:true'>New</li>
    <li data-dojo-type="dojox.mobile.TabBarButton"
       data-dojo-props='moveTo:"subview2"'>What's Hot</li>
  </ul>

 <div id="subview1" data-dojo-type="dojox.mobile.ScrollableView"
        data-dojo-props='selected:true'>
    <ul data-dojo-type="dijit.layout.BorderContainer">
      <li data-dojo-type="dijit.layout.ContentPane"
       data-dojo-props='region:"center", href:"view1.html"'>Hello</li>
    </ul>
 </div>

  <div id="subview2" data-dojo-type="dojox.mobile.ScrollableView" data-dojo-props=''>
    <ul data-dojo-type="dijit.layout.BorderContainer">
        <li data-dojo-type="dijit.layout.ContentPane"
             data-dojo-props='region:"center", href:"view2.html"'></li>
  </ul>
</div></div>

 <script type="text/javascript">
       require(["dojox/mobile/TabBar", "dojox/mobile/TabBarButton", "dojox/mobile/TabBarButton", "dojox/mobile/ScrollableView", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"], function() {
              dojo.parser.parse();
       });
 </script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM