-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Person list #45
Person list #45
Conversation
<mdl-textfield floating-label="Birth Year" :value.sync="personData.birth_year"></mdl-textfield> | ||
<mdl-textfield floating-label="Gender" :value.sync="personData.gender"></mdl-textfield> | ||
<div class="mdl-card__actions"> | ||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label is-upgraded is-dirty"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is-updgraded and is-dirty are dynamic classes that should be added by mdl once you make a call to the component handler to upgrade the elements
<select class="full-width-select" | ||
name="person-select" | ||
v-model="idForName" | ||
v-on:change="fetchPerson"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you the shorthand @change here instead of v-on:change
this.loading = true; | ||
this.imageShow = false; | ||
this.personImageMsg = ''; | ||
const randomPersonId = Math.floor((Math.random() * 87) + 1); | ||
person.fetch(randomPersonId).then((personData) => { | ||
person.fetch(this.idForName).then((personData) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not need the parens around personData
name="person-select" | ||
v-model="idForName" | ||
v-on:change="fetchPerson"> | ||
<option v-for="option in nameList" v-bind:value="option.value"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v:bind:value is the long form. Can use just :value
person.fetchPage = (resolve, pageNumber) => { | ||
const pageToGet = `${personBaseUrl}?page=${pageNumber}`; | ||
Vue.http.get(pageToGet).then(response => { | ||
for (const result of response.data.results) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use an object with a constructor to encapsulate this logic and move it to a testable unit.
Adds a list of all people for issue #12
I initially tried using mdl-select from vue-mdl, but that component is fairly buggy. I ran into posva/vue-mdc#46 and also there seem to be some deeper problems with data binding.
Anyway, I switched to a regular select which works fine.