Homepage.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div>
  3. <h1>Sites</h1>
  4. <form>
  5. <field
  6. v-for="field in exampleFields"
  7. :name="field.name"
  8. :minEntries="field.minEntries"
  9. :maxEntries="field.maxEntries"
  10. :initialEntries="field.initialEntries"
  11. :fieldTypes="field.fieldTypes"/>
  12. </form>
  13. </div>
  14. </template>
  15. <script>
  16. import Field from '../components/Field.vue';
  17. import io from "../../io.js";
  18. export default {
  19. components: { Field },
  20. data: () => {
  21. return {
  22. exampleFields: [
  23. {
  24. name: "Domain",
  25. fieldTypes: [
  26. {
  27. type: "checkbox",
  28. extraButtons: []
  29. },
  30. {
  31. type: "select",
  32. options: [
  33. {
  34. value: "option1",
  35. text: "Option 1"
  36. },
  37. {
  38. value: "option2",
  39. text: "Option 2"
  40. },
  41. {
  42. value: "option3",
  43. text: "Option 3"
  44. }
  45. ]/*,
  46. extraButtons: [
  47. {
  48. icon: "~",
  49. style: "red"
  50. }
  51. ]*/
  52. },
  53. {
  54. type: "text",
  55. extraButtons: [],
  56. fill: true
  57. }
  58. ],
  59. minEntries: 0,
  60. maxEntries: 3,
  61. initialEntries: [
  62. [
  63. true,
  64. "option1",
  65. "Hahaha value"
  66. ]
  67. ]
  68. },
  69. {
  70. name: "Apps",
  71. fieldTypes: [
  72. {
  73. type: "select",
  74. options: [
  75. {
  76. value: "option1",
  77. text: "Option 1"
  78. },
  79. {
  80. value: "option2",
  81. text: "Option 2"
  82. },
  83. {
  84. value: "option3",
  85. text: "Option 3"
  86. }
  87. ]/*,
  88. extraButtons: [
  89. {
  90. icon: "~",
  91. style: "red"
  92. }
  93. ]*/
  94. },
  95. {
  96. type: "text",
  97. extraButtons: [],
  98. fill: true
  99. }
  100. ],
  101. minEntries: 0,
  102. maxEntries: 3,
  103. initialEntries: [
  104. [
  105. true,
  106. "option1",
  107. "Hahaha value"
  108. ]
  109. ]
  110. }
  111. ],
  112. accounts: []
  113. }
  114. },
  115. methods: {
  116. },
  117. mounted() {
  118. io.getSocket(socket => {
  119. this.socket = socket;
  120. socket.emit("getAccounts", res => {
  121. this.accounts = res.accounts;
  122. });
  123. });
  124. }
  125. };
  126. </script>
  127. <style lang="scss" scoped>
  128. form {
  129. width: 400px;
  130. }
  131. </style>