/* #, */ {{each _page.list as #todo, #index}} /* dervy:view - view*/ <view name="todo"></view> {{/}}
/*x-bind 'on-' JS*/ <button on-click="model.set('titleColor', this.name)">Select</button>
{{each _page.people}} <tr> /* . this - - */ <td><a href="/people/{{this.id}}">{{this.name}}</a></td> <td>{{this.phone}}</td> <td><a href="mailto:{{this.email}}">{{this.email}}</a></td> <td><a href="http://twitter.com/{{this.twitter}}">{{this.twitter}}</a></td> <td>{{this.gender}}</td> </tr> {{/}}
// app.fn - app.proto, // , , , app.proto.cancel = function() { app.history.back(); };
<Body:> <view name="todos-new" on-submit="list.add()" label="Add todo" autofocus> </view> <view name="todos-list" as="list" items="{{_page.items}}"> </view> <todos-new:> <form on-submit="submit()"> <input type="text" value="{{value}}" placeholder="{{@placeholder}}" autofocus="{{@autofocus}}"> <button type="submit">{{@label}}</button> </form> <todos-list:> <ul> {{each @items as #item, #i}} <li> <input type="checkbox" checked="{{#item.checked}}"> {{#item.text}} <button type="button" on-click="remove(#i)">Delete</button> </li> {{/each}} </ul>
app.component 'todos-new', class TodosNew submit: -> value = @model.del 'value' @emit 'submit', value app.component 'todos-list', class TodosList add: (text) -> @model.push 'list', {text} remove: (index) -> @model.remove 'list', index
Source: https://habr.com/ru/post/213565/
All Articles