在js视图中插入Feed tile。容器1和容器2的瓷砖正在形成,但是饲料瓷砖存在错误

时间:2015-08-17 11:50:42

标签: javascript sapui5 sap-fiori

<!DOCTYPE html>

<html>

<head>

<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.m"></script>
<meta charset="utf-8">
<title>JS Bin</title>


<script>
 var container1 = new sap.m.TileContainer({
  height : "50%",
  tiles : [
           new sap.m.StandardTile({
        icon : "sap-icon://play",
    title : "Important Tile"

  }), 
  new sap.m.StandardTile({
      icon : "sap-icon://pause",
      title : "ANOTHER Important Tile"
  }),
  new sap.m.StandardTile({
      icon : "sap-icon://pause",
      title : "ANOTHER Important Tile"
  }),
  new sap.m.StandardTile({
      icon : "sap-icon://pause",
      title : "ANOTHER Important Tile"
  })
 ]
 })

var container2 = new sap.m.TileContainer({
    height : "50%",
    tiles :[
            new sap.m.StandardTile({
          icon : "sap-icon://play",
      title : "Important Tile"
    }),
    new sap.m.StandardTile({
        icon : "sap-icon://pause",
        title : "ANOTHER Important Tile"

    }),


        ]
})



var oTwoDaysAgo = new Date();
oTwoDaysAgo.setDate(oTwoDaysAgo.getDate() - 2);
var oFinanceArticle = new sap.suite.ui.commons.FeedItem({
    title: "Help! My Sister Wants Me Off Her Credit Cards",
    image: "images/balloons.jpg",
    link: "http://finance.yahoo.com/news/help-sister-wants-off-her-110045864.html",
    source: "Yahoo Finance", 
    publicationDate: oTwoDaysAgo        
});

var oHourAgo = new Date();
oHourAgo.setHours(oHourAgo.getHours() - 1);
var oStyleArticle = new sap.suite.ui.commons.FeedItem({
    title: "How To Be In Style This Season",
    image: "images/grass.jpg",
    link: "http://www.zappos.com/",
    source: "Zappos", 
    publicationDate: oHourAgo       
}); 

var articles = new Array();
articles.push(oStyleArticle);
articles.push(oFinanceArticle);

var container3 = new sap.m.TileContainer({
     height : "50%",
     tiles: [ 
          new sap.suite.ui.commons.FeedTile({
    items: articles,

    })
     ]
 });



  new sap.m.App({
  pages : new sap.m.Page({
    enableScrolling : true,
    title : "Agri",
    content : [container1, container2, container3]
  })
}).placeAt("content");

</script>

<body id="content">

</body>
</html>

1 个答案:

答案 0 :(得分:0)

我认为你不能直接在TileContainer中嵌入sap.suite.ui.commons.FeedTile;你应该把它嵌入sap.m.CustomTile第一个