Skip to content
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

fix(runtime-dom): v-model.number work with select tag #2308

Merged
merged 3 commits into from
Oct 7, 2020

Conversation

edison1105
Copy link
Member

@edison1105 edison1105 commented Oct 6, 2020

fix #2252
I open a new PR and closed the old one #2254

Comment on lines 174 to 177
.map((o: HTMLOptionElement) => {
const domValue = getValue(o)
return castToNumber ? toNumber(domValue) : domValue
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe no need to castToNumber? every time in the .map.

const selectedVal = castToNumber ? temp.map(o=>toNumber(getValue(o))) : temp.map(getValue)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐂B.

@@ -681,6 +681,43 @@ describe('vModel', () => {
expect(bar.selected).toEqual(true)
})

it('v-model.number should work with select tag', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe should include a test case for multiple select also?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.Thanks~😄

@yyx990803 yyx990803 merged commit d744b8a into vuejs:master Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v-model.number does not work for select tag
4 participants