按自定义属性选择铁页面

时间:2016-01-25 05:20:48

标签: polymer web-component

我有一个带有几个孩子的<iron-pages>元素,每个子元素都是<section>,带有一些文本内容。默认情况下,我可以更改selected元素的<iron-pages>属性,显示的子<section>也会相应更改。

我想在子项上使用自定义属性来选择它们:data-page。我将关联的attrForSelected="data-page"属性添加到<iron-pages>,将data-page属性添加到具有不同字符串的每个孩子(例如home)。但是,使用此系统,子项永远不会显示。即使data-page="home"属性为<iron-pages>的孩子,selected home属性设置为 public sealed class Class2:IBackgroundTask { public void Run(IBackgroundTaskInstance taskInstance) { var def = taskInstance.GetDeferral(); RawNotification notification = (RawNotification)taskInstance.TriggerDetails; string content = notification.Content; ToastTemplateType toastTemplate = ToastTemplateType.ToastText02; XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate); XmlNodeList textElements = toastXml.GetElementsByTagName("text"); textElements[0].AppendChild(toastXml.CreateTextNode("You have pending items to sync")); textElements[1].AppendChild(toastXml.CreateTextNode("Please open the app to sync")); ToastNotificationManager.CreateToastNotifier().Show(new ToastNotification(toastXml)); def.Complete(); // ... // Insert code to start one or more asynchronous methods using the "await" keyword. // var result = await ExampleMethodAsync(); // ... // _deferral.Complete(); } } 时也不会显示。

选择自定义属性我做错了什么?

1 个答案:

答案 0 :(得分:7)

attrForSelected="data-page"应为attr-for-selected="data-page" CamelCase属性被转换为虚线属性(docs)。

相关问题