質問編集履歴
1
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -79,3 +79,107 @@
|
|
79
79
|
<ul>
|
80
80
|
|
81
81
|
```
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
Vue.js
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
```
|
90
|
+
|
91
|
+
let app = new Vue({
|
92
|
+
|
93
|
+
el: "#app",
|
94
|
+
|
95
|
+
data: {
|
96
|
+
|
97
|
+
fruit_type:1,
|
98
|
+
|
99
|
+
fruit_type_optional:[],
|
100
|
+
|
101
|
+
errors:{}
|
102
|
+
|
103
|
+
},
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
created:function () {
|
110
|
+
|
111
|
+
let count_data = 0;
|
112
|
+
|
113
|
+
for (let key in old_data) {
|
114
|
+
|
115
|
+
if (old_data[key] != null && old_data[key] != "") {
|
116
|
+
|
117
|
+
count_data += 1;
|
118
|
+
|
119
|
+
}
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
if (count_data > 0) {
|
124
|
+
|
125
|
+
for (let key in old_data) {
|
126
|
+
|
127
|
+
this.$set(this, key, old_data[key]);
|
128
|
+
|
129
|
+
}
|
130
|
+
|
131
|
+
} else {
|
132
|
+
|
133
|
+
let that = this;
|
134
|
+
|
135
|
+
axios.get('api/getSession')
|
136
|
+
|
137
|
+
.then(res => {
|
138
|
+
|
139
|
+
Object.entries(res.data).map(function (data) {
|
140
|
+
|
141
|
+
console.log(data[0], data[1]);
|
142
|
+
|
143
|
+
if(data[0]!= '_token') {
|
144
|
+
|
145
|
+
that.$set(that, data[0], data[1]);
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
});
|
150
|
+
|
151
|
+
})
|
152
|
+
|
153
|
+
.catch(error => {
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
this.message = 'データの取得に失敗しました。';
|
158
|
+
|
159
|
+
});
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
},
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
});
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
```
|