Can we have different menu items for cards formed

2019-06-22 05:20发布

问题:

I'm creating a bundle using timeline.html as my cover page and providing other sub-pages using the timeline.htmlPages attribute. I want to have different menu items for the cover page as well as for each of the sub-pages. Currently I dont' see any way to have a menuItem for each htmlPage and/or the cover page. Am I missing something ?

I have a work around for this which I did during Glass Foundry : I created a random bundle id, then i looped over all my html pages and using the same bundle id inserted a timeline item, with the same cover page and a single htmlPages with whatever menuItems i want for that index. This works as I want, however since this results in N insert() calls, it takes a lot of time for the glass to receive the bundle [also eats into my api quota as a side effect]

回答1:

You can only have one menu for a given timeline card, even if it has many pages.

timelineItem.html and timelineItem.htmlPages are intended to be used for a single logical piece of content that just happens to exceed the space available on the screen. For this reason, they all share the same menu and the same timelineItem.id.

If you require a different menu for each page, you probably have content that's logically separate. This warrants a distinct timeline card for each piece of content, and this allows you to specify a different menu. Bundling by timelineItem.bundleId allows you to group similar distinct cards, just as you describe.

The total amount of data transmitted is roughly the same, so total latency shouldn't be too much of an issue. If the gradual insert is noticeable, consider only setting timelineItem.notification on the last item to be inserted.