如何迭代div enyos组件?

时间:2016-07-16 21:07:00

标签: javascript jquery html enyo

enyo.kind({
    name: "Usr",
    kind: enyo.Control,

    published: {
        username: "",
        ToDo: [],
        Done:[]
    },

    components: [
        {tag:"title",name:"username"},
        {tag:"input", name:"desc", placeholder: "to do..", 
            style:"width:500px; static: left; padding-right: 10px"}, 
        {tag: "button", content: "New Task", ontap: "addTask", 
            style:"float: right; padding-left: 10px; 
            background-color:orange; color:white" },
        {tag: "div", name: "ToDo" }
    ],

    addTask: function(inSource, inEvent) {
        this.createComponent({
            kind: Task,
            container: this.$.ToDo,
            text: this.$.desc.hasNode().value,
            state: "To do"
        });
        this.$.ToDo.render();
    }
})

所以,这就是我所拥有的。正如您所看到的,我使用(addTask)创建新元素(任务类在其他js文件中定义,并不重要)并将它们放在ToDo“div”组件中。我如何迭代这些元素?像'每个'一句话左右的东西,也许有一个$'div'.length属性或东西?我还没有在任何官方文档中找到答案。

0 个答案:

没有答案