• 这个函数不是必须的,除非你想要完美结合 TypeScript 提供的类型推断来进行项目的开发。
  • 这个函数仅仅提供了类型推断,方便在结合 TypeScript 书写代码时,能为 setup() 中的 props 提供完整的类型推断。
import { createComponent } from 'vue'

export default createComponent({
 props: {
   foo: String
 },
 setup(props) {
   props.foo // <- type: string
 }
})

相关文章:

  • 2021-08-05
  • 2021-06-30
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2021-12-08
  • 2021-10-02
  • 2022-02-17
猜你喜欢
  • 2022-01-19
  • 2021-11-28
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
  • 2021-08-15
相关资源
相似解决方案