回答編集履歴

2

冗長コードなので文字数がキツく、要件に関係ない部分をザックリ削除した

2020/08/27 17:26

投稿

退会済みユーザー
test CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  - .vueのままじゃ共通コードにならなそうだったので動くコードにしつつHTML1本に書き直し
8
8
 
9
+ - 要件に関係ない部分を削除
10
+
9
11
 
10
12
 
11
13
  をベースにし、修正した感じです。
@@ -48,8 +50,6 @@
48
50
 
49
51
  <script>
50
52
 
51
- //import DatePicker from "./DatePicker";
52
-
53
53
  Vue.use(Vuetify);
54
54
 
55
55
  window.addEventListener('DOMContentLoaded', () => {
@@ -60,14 +60,6 @@
60
60
 
61
61
  <v-card>
62
62
 
63
- <v-card-title>
64
-
65
- <span class="headline">add new Travel</span>
66
-
67
- </v-card-title>
68
-
69
- <v-form ref="basic_info" @submit.prevent>
70
-
71
63
  <v-card-text>
72
64
 
73
65
  <v-container>
@@ -110,9 +102,7 @@
110
102
 
111
103
  <v-col cols="12">
112
104
 
113
- <v-text-field label="goal" v-model="goal">
105
+ <v-text-field label="goal" v-model="goal"></v-text-field>
114
-
115
- </v-text-field>
116
106
 
117
107
  </v-col>
118
108
 
@@ -126,18 +116,10 @@
126
116
 
127
117
  <v-row>
128
118
 
129
- <v-spacer></v-spacer>
130
-
131
- <v-btn color="blue darken-1" text @click="close">close</v-btn>
132
-
133
- <v-btn type="submit" color="blue darken-1" text class="mr-3" @click="sendBasicData">start Planning
119
+ <v-btn type="submit" color="blue darken-1" text class="mr-3" @click="sendBasicData">start Planning</v-btn>
134
-
135
- </v-btn>
136
120
 
137
121
  </v-row>
138
122
 
139
- </v-form>
140
-
141
123
  </v-card>
142
124
 
143
125
  `,
@@ -196,12 +178,6 @@
196
178
 
197
179
  methods: {
198
180
 
199
- close() {
200
-
201
- this.$emit("close");
202
-
203
- },
204
-
205
181
  sendBasicData() {
206
182
 
207
183
  console.log(this.start_date);
@@ -240,66 +216,34 @@
240
216
 
241
217
  template: `
242
218
 
243
- <div>
244
-
245
- <v-card class="mx-5 my-5" max-width="800">
219
+ <v-card class="mx-5 my-5" max-width="800">
246
-
247
- <v-img class="white--text align-end" height="200px" :src="image_src">
220
+
248
-
249
- <v-card-title>{{ basic_info.destination }}</v-card-title>
221
+ <v-card-title>{{ basic_info.destination }}</v-card-title>
250
-
222
+
251
- </v-img>
223
+ <v-card-subtitle class="title">{{ basic_info.start_date }} 〜 {{ basic_info.end_date }}</v-card-subtitle>
252
-
224
+
253
- <v-card-subtitle class="title">{{ basic_info.start_date }} 〜
225
+ <v-card-text class="text--primary">{{ basic_info.goal }}</v-card-text>
254
-
255
- {{ basic_info.end_date }}</v-card-subtitle>
226
+
256
-
257
- <v-card-text class="text--primary">
258
-
259
- {{ basic_info.goal }}
260
-
261
- </v-card-text>
262
-
263
-
264
-
265
- <v-card-actions>
227
+ <v-card-actions>
266
-
267
- <v-spacer></v-spacer>
228
+
268
-
269
-
270
-
271
- <v-dialog v-model="basic_info_dialog" persistent max-width="600px">
229
+ <v-dialog v-model="basic_info_dialog" persistent max-width="600px">
272
-
230
+
273
- <template v-slot:activator="{ on }">
231
+ <template v-slot:activator="{ on }">
274
-
232
+
275
- <v-btn v-on="on" text>Edit</v-btn>
233
+ <v-btn v-on="on" text>Edit</v-btn>
276
-
234
+
277
- </template>
235
+ </template>
278
-
236
+
279
- <basicInfoForm v-bind.sync="basic_info" @submit="editBasictest" @close="closeForm"></basicInfoForm>
237
+ <basicInfoForm v-bind.sync="basic_info" @submit="editBasictest" @close="closeForm"></basicInfoForm>
280
-
238
+
281
- </v-dialog>
239
+ </v-dialog>
282
-
283
- <v-btn text>
240
+
284
-
285
- Detail
286
-
287
- </v-btn>
288
-
289
- </v-card-actions>
241
+ </v-card-actions>
290
-
242
+
291
- </v-card>
243
+ </v-card>
292
-
293
- </div>
294
244
 
295
245
  `,
296
246
 
297
- props: {
298
-
299
- travel_id: {},
300
-
301
- },
302
-
303
247
  components: {
304
248
 
305
249
  basicInfoForm: child,
@@ -310,8 +254,6 @@
310
254
 
311
255
  return {
312
256
 
313
- image_src: null,
314
-
315
257
  basic_info: {
316
258
 
317
259
  destination: null,
@@ -326,26 +268,12 @@
326
268
 
327
269
  basic_info_dialog: null,
328
270
 
329
- hasNoTravels: null,
330
-
331
271
  };
332
272
 
333
273
  },
334
274
 
335
- created() {
336
-
337
- this.getUserBasicData();
338
-
339
- },
340
-
341
275
  methods: {
342
276
 
343
- getUserBasicData: async function () {
344
-
345
- console.log(this.travel_id);
346
-
347
- },
348
-
349
277
  closeForm() {
350
278
 
351
279
  this.basic_info_dialog = !this.basic_info_dialog;
@@ -368,14 +296,6 @@
368
296
 
369
297
  },
370
298
 
371
- editBasicData() {
372
-
373
- const self = this;
374
-
375
- self.basic_info_dialog = !self.basic_info_dialog;
376
-
377
- },
378
-
379
299
  },
380
300
 
381
301
  };
@@ -400,8 +320,6 @@
400
320
 
401
321
  </head>
402
322
 
403
-
404
-
405
323
  <body>
406
324
 
407
325
  <div id="app">
@@ -410,11 +328,7 @@
410
328
 
411
329
  <v-main>
412
330
 
413
- <v-container>
414
-
415
- <app></app>
331
+ <app></app>
416
-
417
- </v-container>
418
332
 
419
333
  </v-main>
420
334
 

1

改行あるのに勝手に箇条書きと次の文がくっついてたので改行追加

2020/08/27 17:26

投稿

退会済みユーザー
test CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  - .vueのままじゃ共通コードにならなそうだったので動くコードにしつつHTML1本に書き直し
8
8
 
9
+
10
+
9
11
  をベースにし、修正した感じです。
10
12
 
11
13