2016-08-11 4 views
0

https://developer.apple.com/library/tvos/samplecode/TVMLCatalog/Introduction/Intro.html#//apple_ref/doc/uid/TP40016505 私は私がすることができ、上部にmenueを表示したいアプリのzova に似開始部位を作ってみましたリモートコントロールにスワイプで表示されます 各メニューポイントはサブページを直接表示する必要があります。ホームサイト - このサンプルコードに基づいて、TVML

現在のところ、3つのmenueポイントしか表示されていませんが、内容は表示されません。 アプリを起動すると、/templates/home/Index.xmlが直接開かれます。そして、私はリモコンにmenueボタン付きのmenueに戻ることができます。

<document> 
<menuBarTemplate> 
<menuBar> 
    <menuItem id="navigation_top_travel" data-identifier="list" documentURL="/templates/home/Index.xml" autoHighlight="true"> 
    <title>Home</title> 
    </menuItem> 
    <menuItem id="navigation_top_remember" data-identifier="remember" documentURL="/templates/remember/Index.xml"> 
    <title>Likes</title> 
    </menuItem> 
    <menuItem id="navigation_top_settings" data-identifier="edit" documentURL="/templates/settings/Index.xml"> 
    <title>Settings</title> 
    </menuItem> 
</menuBar> 
</menuBarTemplate> 
</document> 

がどのように私はこの問題を解決することができます

私のインデックスxmlファイルには、次の内容を持っていますか? ありがとうございます。

答えて

0

これを行うには、getFeatureを使用する必要があります。

doc.addEventListener("select", (event) => { 
    const target = event.target; 
    const ele = target.parentNode; 
    const feature = ele.getFeature("MenuBarDocument"); 
    const featureDoc = feature.getDocument(target); 
    if (featureDoc == null) { 
     const documentURL = target.getAttribute("documentURL"); 
     let docFromURL = your_function_get_doc_from_url(documentURL); 
     feature.setDocument(docFromURL); 
    } 
}); 
関連する問題