Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 217cbcc

Browse files
committed
initial commit
1 parent bf8e1cc commit 217cbcc

File tree

2 files changed

+60
-24
lines changed

2 files changed

+60
-24
lines changed

‎resources/js/pages/auth/register.vue

Lines changed: 55 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,30 @@
99
<b-form-input type="text" id="name" name="name" :class="{ 'is-invalid': form.errors.has('name') }" v-model="form.name"></b-form-input>
1010
<has-error :form="form" field="name" />
1111
</b-form-group>
12+
<b-form-group
13+
label="Hobbies:"
14+
label-for="hobbies">
15+
<b-form-select id="hobbies" name="hobbies" :class="{ 'is-invalid': form.errors.has('hobbies') }" v-model="form.hobbies" :options="options"></b-form-select>
16+
<has-error :form="form" field="hobbies" />
17+
</b-form-group>
1218
<b-form-group
1319
label="Email:"
1420
label-for="email" >
1521
<b-form-input type="email" id="email" name="email" :class="{ 'is-invalid': form.errors.has('email') }" v-model="form.email"></b-form-input>
1622
<has-error :form="form" field="email" />
1723
</b-form-group>
24+
<b-form-group
25+
label="Phone:"
26+
label-for="phone">
27+
<b-form-input :number="true" :formatter="formatPhone" type="text" id="phone" name="phone" :class="{ 'is-invalid': form.errors.has('phone') }" v-model="form.phone"></b-form-input>
28+
<has-error :form="form" field="phone" />
29+
</b-form-group>
30+
<b-form-group
31+
label="Country:"
32+
label-for="countries">
33+
<b-form-select id="countries" name="country_id" value-field="id" text-field="name" :class="{ 'is-invalid': form.errors.has('country_id') }" v-model="form.country_id" :options="countries"></b-form-select>
34+
<has-error :form="form" field="country_id" />
35+
</b-form-group>
1836
<b-form-group
1937
label="Password:"
2038
label-for="password" >
@@ -38,32 +56,50 @@
3856
import Form from 'vform'
3957
4058
export default {
41-
components: {
42-
},
59+
components: {},
4360
44-
middleware: 'guest',
61+
middleware: 'guest',
4562
46-
data: () => ({
47-
form: new Form({
48-
name: '',
49-
email: '',
50-
password: '',
51-
password_confirmation: ''
52-
})
53-
}),
63+
data: () => ({
64+
form: new Form({
65+
name: '',
66+
hobbies: '',
67+
email: '',
68+
phone: '',
69+
country_id: 1,
70+
password: '',
71+
password_confirmation: ''
72+
}),
73+
options: [
74+
{ value: 'Soccer', text: 'Soccer'},
75+
{ value: 'Game', text: 'Game'},
76+
{ value: 'Watching', text: 'Watching'}
77+
],
78+
countries: []
79+
}),
5480
55-
methods: {
56-
async register () {
57-
const { data } = await this.form.post('/api/register')
81+
methods: {
82+
async register () {
83+
const { data } = await this.form.post('/api/register')
5884
59-
const { data: { token } } = await this.form.post('/api/login')
85+
const { data: { token } } = await this.form.post('/api/login')
6086
61-
this.$store.dispatch('auth/saveToken', { token })
87+
this.$store.dispatch('auth/saveToken', { token })
6288
63-
await this.$store.dispatch('auth/updateUser', { user: data })
89+
await this.$store.dispatch('auth/updateUser', { user: data })
6490
65-
this.$router.push({ name: 'home' })
91+
this.$router.push({ name: 'home' })
92+
},
93+
async loadCountries () {
94+
const { data } = await this.form.get('/api/countries')
95+
this.countries = data;
96+
},
97+
formatPhone(e){
98+
return String(e).substring(0,10);
99+
}
100+
},
101+
mounted() {
102+
this.loadCountries()
66103
}
67-
}
68104
}
69105
</script>

‎resources/js/pages/home.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
<b-form-group
1414
label="Author:"
1515
label-for="author">
16-
<b-form-select id="author" name="author" :class="{ 'is-invalid': form.errors.has('author') }" v-model="form.author" :options="options"></b-form-select>
17-
<!-- <b-form-input id="user" name="user" :is-invalid': form.errors.has('user') }" v-model="form.user" list="my-list-id"></b-form-input>-->
18-
<!-- <datalist id="my-list-id">-->
19-
<!-- <option v-for="option in options">{{ option.text }}</option>-->
20-
<!-- </datalist>-->
16+
<!-- <b-form-select id="author" name="author" :class="{ 'is-invalid': form.errors.has('author') }" v-model="form.author" :options="options"></b-form-select>-->
17+
<b-form-input id="author" name="author" :class="{ 'is-invalid': form.errors.has('author') }" v-model="form.user" list="my-list-id"></b-form-input>
18+
<datalist id="my-list-id">
19+
<option v-for="option in options">{{ option.text }}</option>
20+
</datalist>
2121
<has-error :form="form" field="author" />
2222
</b-form-group>
2323
<b-form-group

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /