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

New Design for Vue 3 JSX #10

Closed
Amour1688 opened this issue Jun 12, 2020 · 3 comments
Closed

New Design for Vue 3 JSX #10

Amour1688 opened this issue Jun 12, 2020 · 3 comments

Comments

@Amour1688
Copy link
Member

Implementation Detail and new Design to discuss

  • vModel
  • slot
  • directives
  • modifiers
  • ...
@Amour1688 Amour1688 changed the title New Design for Vue 3 New Design for Vue 3 JSX Jun 12, 2020
@Amour1688 Amour1688 pinned this issue Jun 16, 2020
@tangjinzhou
Copy link
Contributor

ref vuejs/jsx-vue2#141

@wonderful-panda
Copy link

About '.sync' modifier

In vue-next, we should use v-model instead of .sync modifier.

<MyComp v-model={[value, "foo"]} />

But I think this is not suitable for TSX in some points.

  1. TypeScript can't check type of value is assignable to foo or not.

  2. When foo is defined as required, TS2322 (Property 'foo' is missing in ...) will occur

I guess it is not impossible to solve them by changing type definitions, but it will makes type definitions too complex.

Simple solution is giving up v-model.

<MyComp foo={value} on={{ "update:foo": v => value = v }} />

Is there any other (more smart) solutions ?

@Amour1688
Copy link
Member Author

Amour1688 commented Sep 7, 2020

<MyComp foo={value} on={{ "update:foo": v => value = v }} />

Will you change type definitions when giving up v-model like above.

interface Props {
  foo?: string;
  on?: {
    'update:foo': (val: string) => void;
  }
}

Or

interface Props {
  vModel?: [string, 'foo']
}

But I think it will be a misunderstand because vModel is not a prop

@Amour1688 Amour1688 unpinned this issue Oct 27, 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

No branches or pull requests

3 participants