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

How to use v-model in component? #151

Closed
lilililee opened this issue Oct 27, 2020 · 7 comments
Closed

How to use v-model in component? #151

lilililee opened this issue Oct 27, 2020 · 7 comments

Comments

@lilililee
Copy link

lilililee commented Oct 27, 2020

// index.tsx
image

// Modal.tsx
image

I refer <A v-model={[val, 'argument', ['modifier']]} />, but got typescript error.

Version:
vue: 3.0.2
@vue/babel-plugin-jsx: 1.0.0-rc.3
typescript: 3.9.7

@Zcating
Copy link

Zcating commented Oct 27, 2020

Have you checked your Vue version?

@Amour1688
Copy link
Member

missing required modelValue

@Zcating
Copy link

Zcating commented Oct 27, 2020

Maybe remove the required key in props or add modelValue={state.visible} in the tag attribute.

@lilililee
Copy link
Author

@Amour1688 Typescript error has gone after missing required modelValue and v-model already work, but I think modelValue set required: true is nothing wrong. Is it a bug?

@Amour1688
Copy link
Member

@Amour1688 Typescript error has gone after missing required modelValue and v-model already work, but I think modelValue set required: true is nothing wrong. Is it a bug?

image

@TheDutchCoder
Copy link

TheDutchCoder commented Dec 3, 2021

This issue shouldn't be closed, requiring a v-model is very normal and jsx should know how to map v-model to modelValue.

source: https://v3.vuejs.org/guide/render-function.html#v-model

@chaozwn
Copy link

chaozwn commented Jan 11, 2023

i think this problem should be solved.i think it may be a typescript problem. v-model:modelValue.trim also has question.

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

No branches or pull requests

5 participants