質問編集履歴
7
Bvueのkeyを修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -82,7 +82,7 @@
|
|
82
82
|
|
83
83
|
<v-row v-for="A in Alist" :key="A.id">
|
84
84
|
|
85
|
-
<v-card v-for="a in A" :key="
|
85
|
+
<v-card v-for="a in A" :key="A.id"
|
86
86
|
|
87
87
|
height="30px" width="30px">{{ a }}</v-card>
|
88
88
|
|
6
key部分の記述を修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,9 +80,9 @@
|
|
80
80
|
|
81
81
|
<template>
|
82
82
|
|
83
|
-
<v-row v-for="A in Alist" :key="
|
83
|
+
<v-row v-for="A in Alist" :key="A.id">
|
84
84
|
|
85
|
-
<v-card v-for="a in A" :key="
|
85
|
+
<v-card v-for="a in A" :key="a.id"
|
86
86
|
|
87
87
|
height="30px" width="30px">{{ a }}</v-card>
|
88
88
|
|
5
vuexと画面のコードを修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
state: {
|
20
20
|
|
21
|
-
Alist: [],
|
21
|
+
Alist: [{ name: ''}],
|
22
22
|
|
23
23
|
A: ''
|
24
24
|
|
@@ -80,7 +80,13 @@
|
|
80
80
|
|
81
81
|
<template>
|
82
82
|
|
83
|
+
<v-row v-for="A in Alist" :key="key.id">
|
84
|
+
|
85
|
+
<v-card v-for="a in A" :key="key.id"
|
86
|
+
|
83
|
-
|
87
|
+
height="30px" width="30px">{{ a }}</v-card>
|
88
|
+
|
89
|
+
</v-row>
|
84
90
|
|
85
91
|
</template>
|
86
92
|
|
@@ -90,15 +96,9 @@
|
|
90
96
|
|
91
97
|
computed: {
|
92
98
|
|
93
|
-
A() {
|
99
|
+
Alist: function() {
|
94
100
|
|
95
|
-
return store.state.A
|
96
|
-
|
97
|
-
},
|
98
|
-
|
99
|
-
Alist() {
|
100
|
-
|
101
|
-
return store.state.Alist
|
101
|
+
return this.$store.state.Alist
|
102
102
|
|
103
103
|
}
|
104
104
|
|
4
Bvueを編集しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
|
81
81
|
<template>
|
82
82
|
|
83
|
-
<v-card v-for="
|
83
|
+
<v-card v-for="A in Alist" :key="A.id" height="30px" width="30px">{{ A }}</v-card>
|
84
84
|
|
85
85
|
</template>
|
86
86
|
|
3
keyを追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
|
81
81
|
<template>
|
82
82
|
|
83
|
-
<v-card v-for="A in Alist" height="30px" width="30px">{{ A }}</v-card>
|
83
|
+
<v-card v-for="(A, key) in Alist" height="30px" width="30px">{{ A }}</v-card>
|
84
84
|
|
85
85
|
</template>
|
86
86
|
|
@@ -112,6 +112,6 @@
|
|
112
112
|
|
113
113
|
```ターミナル
|
114
114
|
|
115
|
-
|
115
|
+
//ターミナルのエラーはなくなりました
|
116
116
|
|
117
117
|
```
|
2
エラーコード追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -107,3 +107,11 @@
|
|
107
107
|
</script>
|
108
108
|
|
109
109
|
```
|
110
|
+
|
111
|
+
エラー内容追記します
|
112
|
+
|
113
|
+
```ターミナル
|
114
|
+
|
115
|
+
(Emitted value instead of an instance of Error) <v-card v-for="A in Alist">: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.
|
116
|
+
|
117
|
+
```
|
1
コードとやりたいことを具体的に記載しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,22 +4,106 @@
|
|
4
4
|
|
5
5
|
単体で取得表示する方法はわかるのですが教えて頂きたいです。
|
6
6
|
|
7
|
+
|
8
|
+
|
9
|
+
やりたいことは以下です。
|
10
|
+
|
11
|
+
画面Aで値取得
|
12
|
+
|
13
|
+
画面B(別画面)で値表示&追加ボタンでB画面に戻り、繰り返すだけここに値が追加されていく
|
14
|
+
|
15
|
+
|
16
|
+
|
7
17
|
```vuex
|
8
18
|
|
9
19
|
state: {
|
10
20
|
|
11
|
-
As: [
|
21
|
+
Alist: [],
|
12
22
|
|
13
23
|
A: ''
|
14
24
|
|
15
25
|
}
|
16
26
|
|
27
|
+
|
28
|
+
|
29
|
+
mutations: {
|
30
|
+
|
31
|
+
updateA(state, payload) {
|
32
|
+
|
33
|
+
state.A = payload
|
34
|
+
|
35
|
+
},
|
36
|
+
|
37
|
+
updateAlist(state, payload) {
|
38
|
+
|
39
|
+
state.Alist = state.A[payload]
|
40
|
+
|
41
|
+
},
|
42
|
+
|
43
|
+
```
|
44
|
+
|
45
|
+
```Avue
|
46
|
+
|
47
|
+
<template>
|
48
|
+
|
49
|
+
<v-btn @click="pushA(A), pushAlist(A)"></v-btn>
|
50
|
+
|
51
|
+
//実際にはリンゴやバナナのボタンがありますが省略しています
|
52
|
+
|
53
|
+
</template>
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
<script>
|
58
|
+
|
59
|
+
methods: {
|
60
|
+
|
61
|
+
pushA(A) {
|
62
|
+
|
63
|
+
this.$store.commit('updateA', A)
|
64
|
+
|
65
|
+
},
|
66
|
+
|
67
|
+
pushAlist(A) {
|
68
|
+
|
69
|
+
this.$store.commit('updateAlist', A)
|
70
|
+
|
71
|
+
},
|
72
|
+
|
73
|
+
},
|
74
|
+
|
17
75
|
```
|
18
76
|
|
19
77
|
|
20
78
|
|
21
|
-
```
|
79
|
+
```Bvue
|
22
80
|
|
81
|
+
<template>
|
82
|
+
|
23
|
-
<v-card v-for="A in As" height="30px" width="30px">{{ A }}</v-card>
|
83
|
+
<v-card v-for="A in Alist" height="30px" width="30px">{{ A }}</v-card>
|
84
|
+
|
85
|
+
</template>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<script>
|
90
|
+
|
91
|
+
computed: {
|
92
|
+
|
93
|
+
A() {
|
94
|
+
|
95
|
+
return store.state.A
|
96
|
+
|
97
|
+
},
|
98
|
+
|
99
|
+
Alist() {
|
100
|
+
|
101
|
+
return store.state.Alist
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
</script>
|
24
108
|
|
25
109
|
```
|