index.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. <link rel="stylesheet" href="../lib/bulma-0.5.0.css" />
  7. <link rel="stylesheet" href="../styles.css" />
  8. <link rel="stylesheet" href="styles.css" />
  9. </head>
  10. <body class="section">
  11. <nav>
  12. <h1><span class="index">20</span>Object-oriented forms: part 2</h1>
  13. <ul>
  14. <li><a href="../lesson19">Prev</a></li>
  15. <li><a href="../lesson21">Next</a></li>
  16. </ul>
  17. </nav>
  18. <div id="root" class="container">
  19. <list :projects="projects">
  20. <template></template>
  21. </list>
  22. <form method="post" action="projects" @submit.prevent="onSubmit" @keydown="form.errors.clear($event.target.name)">
  23. <div class="control">
  24. <label for="name" class="label">Project name:</label>
  25. <input type="text" id="name" name="name" class="input" v-model="form.name"/>
  26. </div>
  27. <div class="control">
  28. <label for="description" class="label">Project description:</label>
  29. <input type="text" id="description" name="description" class="input" v-model="form.description" />
  30. </div>
  31. <div class="control">
  32. <button class="button is-primary" :disabled="form.errors.any()">Create</button>
  33. </div>
  34. <span class="help is-danger" v-if="form.errors.has('name')" v-text="form.errors.get('name')"></span>
  35. </form>
  36. </div>
  37. <script type="text/x-template" id="list">
  38. <table class="table">
  39. <caption>List of projects</caption>
  40. <thead>
  41. <tr>
  42. <th>Name</th>
  43. <th>Description</th>
  44. </tr>
  45. </thead>
  46. <tbody>
  47. <!-- props are directly available by name -->
  48. <tr v-for="project in projects">
  49. <td>{{ project.name }}</td>
  50. <td>{{ project.description }}</td>
  51. </tr>
  52. </tbody>
  53. </table>
  54. </script>
  55. <script src="../lib/axios-0.16.2.min.js"></script>
  56. <!-- script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.16.2/axios.js"></script -->
  57. <script src="../lib/vue-2.1.6.js"></script>
  58. <script src="code.js"></script>
  59. </body>
  60. </html>