07: Directive Shorthand

Some directives can be abbreviated with shorthand syntax.

  1. :: is alias of x-controller _.
  2. :xxx is alias of x-bind:xxx.
  3. @yyy is alias of x-on:yyy.

<body>
  <section class="todoapp"

    x-controller
  _
  ::>
    <header class="header">
      <h1>todos</h1>
      <input class="new-todo"
        autofocus
        autocomplete="off"
        placeholder="What needs to be done?"

        x-on:@change="addTodo({newTodo: launcher$.value})"
        x-callbacks="{
          change (_) {
            _.$.value = ''
          }
        }"
      >
    </header>
    <section class="main">

      <ul class="todo-list"
        x-each="todo in todos"
      >
        <li class="todo"
          x-bind:class="{
            completed: todo.completed,
          }"
        >

        </li>
      </ul>
    </section>

  </section>
</body>
</html>