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

[Question] vue3.4之后tsx中使用指令(例如vModel)会报错 #716

Closed
rainmanhhh opened this issue Jul 9, 2024 · 2 comments
Closed
Labels
question Further information is requested

Comments

@rainmanhhh
Copy link

vue3.4官方推荐用"jsxImportSource": "vue"来引入tsx类型定义,手动写在shims.d.ts中的定义不起作用:

declare namespace JSX {
  export interface IntrinsicAttributes {
    vIf?: unknown
    vElseIf?: unknown
    vElse?: unknown
    vShow?: unknown
    vHtml?: unknown
    vText?: unknown
    vModel?: unknown
    vSlots?: {
      default?: Slot
      [key: string]: Slot
    }
  }
}

怎么修改呢

@rainmanhhh rainmanhhh added the question Further information is requested label Jul 9, 2024
@zhiyuanzmj
Copy link
Collaborator

zhiyuanzmj commented Jul 11, 2024

你可以试试 加一个type

// tsconfig.json

{
 "compilerOptions": {
    "types": ["vue/jsx"]
  }
}

@zhiyuanzmj
Copy link
Collaborator

对了如果你想用 v-model v-if v-for v-slot 等指令 并且有类型提示 可以试试
https://vue-macros.dev/features/jsx-directive.html

@sxzz sxzz closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2024
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

3 participants