質問編集履歴

2

本文修正

2018/09/05 13:52

投稿

garchomp
garchomp

スコア128

test CHANGED
File without changes
test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  ていう感じに追加したいけど、v-forが更新されません。
48
48
 
49
- 調べてみたところ、リアクティブになっていない可能性があるところまではわかったのですが、どう対策したらいいかがわかりません…
49
+ 調べてみたところ、レンダングができていないところまではわかったのですが、どう対策したらいいかがわかりません…
50
50
 
51
51
  解決策わかる方いましたらご教授お願いしますm(_ _)m
52
52
 

1

全体位を載せました

2018/09/05 13:52

投稿

garchomp
garchomp

スコア128

test CHANGED
File without changes
test CHANGED
@@ -49,3 +49,189 @@
49
49
  調べてみたところ、リアクティブになっていない可能性があるところまではわかったのですが、どう対策したらいいかがわかりません…
50
50
 
51
51
  解決策わかる方いましたらご教授お願いしますm(_ _)m
52
+
53
+
54
+
55
+ 追記:全体
56
+
57
+ ```vue
58
+
59
+ <template>
60
+
61
+ <v-ons-page>
62
+
63
+ <div class="">
64
+
65
+ <p style="margin-left:15px; float:left;">参加中のカテゴリー</p>
66
+
67
+ <p class="join-category-link" @click="CategoryEdit">編集</p>
68
+
69
+ </div>
70
+
71
+ <div style="clear:both;"></div>
72
+
73
+ <component
74
+
75
+ :is="JoinCategoryPage"
76
+
77
+ :page-stack="pageStack"></component>
78
+
79
+ <p style="margin-left:15px;">すべてのカテゴリー</p>
80
+
81
+ <component
82
+
83
+ v-for="category in allCategories"
84
+
85
+ :is="CategoryIndexPage"
86
+
87
+ :key="category.id"
88
+
89
+ :title="category.title"
90
+
91
+ :image="category.image"
92
+
93
+ PropsWidth="25"
94
+
95
+ :page-stack="pageStack"
96
+
97
+ class="all-category"
98
+
99
+ ></component>
100
+
101
+ </v-ons-page>
102
+
103
+ </template>
104
+
105
+ <script>
106
+
107
+ import JoinCategory from '../Category/components/JoinCategory'
108
+
109
+ import MenuPage from './MenuPage'
110
+
111
+ import CategoryIndex from '../Category/Index'
112
+
113
+ const axios = require('axios')
114
+
115
+ export default {
116
+
117
+ name: 'home',
118
+
119
+ props: ['pageStack'],
120
+
121
+ data () {
122
+
123
+ return {
124
+
125
+ title: 'title',
126
+
127
+ CategoryIndexPage: CategoryIndex,
128
+
129
+ JoinCategoryPage: JoinCategory,
130
+
131
+ allCategories: [
132
+
133
+ {
134
+
135
+ id: 1,
136
+
137
+ title: 'hoge',
138
+
139
+ image: 'block.jpg'
140
+
141
+ }
142
+
143
+ ]
144
+
145
+ }
146
+
147
+ },
148
+
149
+ created: function () {
150
+
151
+ const self = this
152
+
153
+ this.axios
154
+
155
+ .get(process.env.BASE_URL + 'all_category')
156
+
157
+ .then(function (res) {
158
+
159
+ self.allCategories = res.data
160
+
161
+ self.allCategories.push({ title: 'hogehoge', image: 'block.jpg' })
162
+
163
+ console.log(self.allCategories)
164
+
165
+ })
166
+
167
+ },
168
+
169
+ mounted: function () {
170
+
171
+ axios
172
+
173
+ .get('https://api.coindesk.com/v1/bpi/currentprice.json')
174
+
175
+ .then(response => {
176
+
177
+ })
178
+
179
+ .catch(error => {
180
+
181
+ console.log(error)
182
+
183
+ this.errored = true
184
+
185
+ })
186
+
187
+ },
188
+
189
+ methods: {
190
+
191
+ push () {
192
+
193
+ this.pageStack.push(MenuPage)
194
+
195
+ },
196
+
197
+ CategoryEdit () {
198
+
199
+ console.log('CategoryEdit READY!')
200
+
201
+ }
202
+
203
+ }
204
+
205
+ }
206
+
207
+ </script>
208
+
209
+
210
+
211
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
212
+
213
+ <style lang="scss">
214
+
215
+ .center {
216
+
217
+ text-align: center;
218
+
219
+ }
220
+
221
+ .join-category-link {
222
+
223
+ float: right;
224
+
225
+ margin-right: 15px;
226
+
227
+ color: gray;
228
+
229
+ }
230
+
231
+
232
+
233
+ </style>
234
+
235
+
236
+
237
+ ```