index.html 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <!doctype html>
  2. <head>
  3. <meta charset="utf-8" />
  4. </head>
  5. <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.red-blue.min.css" />
  6. <script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
  7. <style>
  8. .entry {
  9. width: 100%;
  10. background-color: aquamarine;
  11. padding: 2em;
  12. }
  13. .title {
  14. display: inline-block;
  15. width: 6em;
  16. }
  17. </style>
  18. <div id="app">
  19. <button onclick="adapter.setter()">save</button>
  20. <button onclick="adapter.getter()">load</button>
  21. <template v-for="(value, key) in config">
  22. <br>
  23. <div class="title">{{key}}</div><input v-model="config[key]">
  24. </template>
  25. <pre>
  26. {{config}}
  27. </pre>
  28. </div>
  29. <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  30. <script src="adapter.js"></script>
  31. <script>
  32. var app = new Vue({
  33. el: '#app',
  34. data: {
  35. config: {
  36. age: 42,
  37. attributes: ["Fluff", "yo"],
  38. },
  39. },
  40. mounted: function () {
  41. adapter.onget = function () {
  42. app.config = adapter.responseJson
  43. }
  44. adapter.onset = function () {
  45. return app.config;
  46. }
  47. // adapter.getter();
  48. },
  49. watch: {},
  50. computed: {
  51. test: function () {},
  52. }
  53. })
  54. </script>
  55. <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">