質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,16 @@
|
|
22
22
|
|
23
23
|
- @vue/cli 4.5.11
|
24
24
|
|
25
|
+
- "firebase": "^8.3.1",
|
26
|
+
|
27
|
+
- "vee-validate": "^3.4.5",
|
28
|
+
|
29
|
+
- "vue": "^2.5.2",
|
30
|
+
|
31
|
+
- "vue-router": "^3.0.1",
|
32
|
+
|
33
|
+
- "vuex": "^3.6.2"
|
34
|
+
|
25
35
|
|
26
36
|
|
27
37
|
## ソースコード
|
2
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,9 +18,13 @@
|
|
18
18
|
|
19
19
|
|
20
20
|
|
21
|
-
|
21
|
+
## 環境
|
22
|
+
|
22
|
-
|
23
|
+
- @vue/cli 4.5.11
|
24
|
+
|
25
|
+
|
26
|
+
|
23
|
-
コード
|
27
|
+
## ソースコード
|
24
28
|
|
25
29
|
```vue
|
26
30
|
|
@@ -66,7 +70,171 @@
|
|
66
70
|
|
67
71
|
|
68
72
|
|
73
|
+
## 全体ソースコード
|
74
|
+
|
75
|
+
```vue
|
76
|
+
|
77
|
+
<template>
|
78
|
+
|
79
|
+
<div id="overlay" v-show="showContent2" @click.self="onlyCloseSendModal">
|
80
|
+
|
81
|
+
<div id="main-content">
|
82
|
+
|
83
|
+
<p>あなたの残高:{{ $store.getters.myWallet }}</p>
|
84
|
+
|
85
|
+
<p>送る金額</p>
|
86
|
+
|
87
|
+
<ValidationObserver v-slot="{ invalid }">
|
88
|
+
|
89
|
+
<ValidationProvider name="tipping" rules="my_rule" v-slot="{ errors }">
|
90
|
+
|
91
|
+
<input type="text" class="text" v-model="tippingWallet">
|
92
|
+
|
93
|
+
<p>{{ errors[0] }}</p>
|
94
|
+
|
95
|
+
</ValidationProvider>
|
96
|
+
|
97
|
+
<div id="button-content">
|
98
|
+
|
99
|
+
<p><button @click="closeSendModal" class="modal-button" :disabled="invalid">送信</button></p>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
</ValidationObserver>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
</template>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
<script>
|
114
|
+
|
115
|
+
/* eslint-disable */
|
116
|
+
|
117
|
+
import { ValidationObserver, ValidationProvider, extend, required, numeric, max_value} from '@/VeeValidate/index.js';
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
// 必須
|
122
|
+
|
123
|
+
extend('required', {
|
124
|
+
|
125
|
+
...required,
|
126
|
+
|
127
|
+
message: '必須です。'
|
128
|
+
|
69
|
-
|
129
|
+
});
|
130
|
+
|
131
|
+
// 数値
|
132
|
+
|
133
|
+
extend('numeric', {
|
134
|
+
|
135
|
+
...numeric,
|
136
|
+
|
137
|
+
message: '数値で入力してください。'
|
138
|
+
|
139
|
+
});
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
const myRule = {
|
144
|
+
|
145
|
+
params: ['str'],
|
146
|
+
|
147
|
+
message: '所持金が足りません。',
|
148
|
+
|
149
|
+
validate(value, {str}) {
|
150
|
+
|
151
|
+
return value <= 500;
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
};
|
156
|
+
|
157
|
+
extend('my_rule', myRule);
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
export default {
|
162
|
+
|
163
|
+
components: {
|
164
|
+
|
165
|
+
ValidationObserver,
|
166
|
+
|
167
|
+
ValidationProvider,
|
168
|
+
|
169
|
+
},
|
170
|
+
|
171
|
+
data () {
|
172
|
+
|
173
|
+
return {
|
174
|
+
|
175
|
+
showContent2: false,
|
176
|
+
|
177
|
+
tippingWallet: '',
|
178
|
+
|
179
|
+
aaa: this.$store.getters.myWallet
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
},
|
184
|
+
|
185
|
+
methods: {
|
186
|
+
|
187
|
+
openSendModal (){
|
188
|
+
|
189
|
+
this.$emit('openSendModal');
|
190
|
+
|
191
|
+
},
|
192
|
+
|
193
|
+
closeSendModal (){
|
194
|
+
|
195
|
+
this.$emit('closeSendModal', this.tippingWallet);
|
196
|
+
|
197
|
+
},
|
198
|
+
|
199
|
+
onlyCloseSendModal (){
|
200
|
+
|
201
|
+
this.$emit('onlyCloseSendModal');
|
202
|
+
|
203
|
+
this.tippingWallet = ''
|
204
|
+
|
205
|
+
},
|
206
|
+
|
207
|
+
},
|
208
|
+
|
209
|
+
computed: {
|
210
|
+
|
211
|
+
users () {
|
212
|
+
|
213
|
+
return this.$store.getters.users
|
214
|
+
|
215
|
+
},
|
216
|
+
|
217
|
+
modalData () {
|
218
|
+
|
219
|
+
return this.$store.getters.modalData
|
220
|
+
|
221
|
+
},
|
222
|
+
|
223
|
+
myWallet () {
|
224
|
+
|
225
|
+
return this.$store.getters.myWallet
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
}
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
</script>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
```
|
70
238
|
|
71
239
|
|
72
240
|
|
1
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## やりたいこと
|
2
2
|
|
3
|
-
$store.getters.myWallet(自分
|
3
|
+
$store.getters.myWallet(自分のもっている残高)より多い金額を入力した時、Veevalidateを使用してバリデーション をかけたい
|
4
4
|
|
5
5
|
|
6
6
|
|