Skip to content

[Question] When using jsx, I have a few doubts #472

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

Open
hairyf opened this issue Jul 23, 2021 · 1 comment
Open

[Question] When using jsx, I have a few doubts #472

hairyf opened this issue Jul 23, 2021 · 1 comment
Labels
question Further information is requested

Comments

@hairyf
Copy link

hairyf commented Jul 23, 2021

🧐 Problem Description

I encountered some problems when using v-model, such as using it in template.

<input v-model:xxx="refVal" />

I checked the relevant information and found that it is actually used in jsx like this

<input v-model={[refVal.value, ['xxx']]} />

Well, if it is impossible to achieve a form similar to v-model:xxx, I can understand
But why, why is my xxx that is v-model:[xxx] placed after the array.

<input v-model={[refVal.value, ['xxx']]} />
<input v-models={[[refVal.value, ['xxx']], [refVal.value, ['bbb']]]} />

Instead of this

<input v-model={['xxx', refVal.value]} />
<input v-models={[['xxx', refVal.value], ['bbb', refVal.value]]} />

Or like this

<input v-model={{xxx: refVal.value}} />
<input v-models={[{xxx: refVal.value}, {bbb: refVal.value}]} />

Well, I just don't adapt to this grammar, it makes me feel very messy, or a bit, I want to know what caused it. 🤔

@hairyf hairyf added the question Further information is requested label Jul 23, 2021
@KaelWD
Copy link
Contributor

KaelWD commented Aug 10, 2021

if it is impossible to achieve a form similar to v-model:xxx

Typescript didn't support this until ts 4.2. Vue 3.2 now requires typescript 4.1 so I don't think it's unreasonable to require 4.2 for jsx.

why is my xxx that is v-model:[xxx] placed after the array

This is the same order as vue's withDirectives: https://github.com/vuejs/vue-next/blob/2937530beff5c6bb57286c2556307859e37aa809/packages/compiler-core/src/ast.ts#L426


Duplicate of #325 I guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants