-
Notifications
You must be signed in to change notification settings - Fork 0
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
关于vue3.0-beta搭建开发环境 #4
Comments
vue-next jsx进展尤大在关于vue/jsx的回复 vuejs/jsx/issues/141#issuecomment-658304273,尽可能少的添加语法糖到jsx中,因为选择使用jsx的用户未必一定使用模版语法
在官方提供最新版本支持前、可以使用上面的两个社区的解决方案 |
期待vue jsx能够得到jsx官方的支持jsx刚开始在react中对类型的支持也不好,后来react和ts团队合作再有了现在的完美支持。
希望能够得到jsx官方的支持 |
Vue3.x使用TypeScript
import { defineComponent, PropType } from 'vue'
interface ComplexMessage {
title: string
okMessage: string
cancelMessage: string
}
const Component = defineComponent({
props: {
name: String,
success: { type: String },
callback: {
type: Function as PropType<() => void>
},
message: {
type: Object as PropType<ComplexMessage>,
required: true,
validator(message: ComplexMessage) {
return !!message.title
}
}
}
}) https://v3.vuejs.org/guide/typescript-support.html#annotating-return-types |
目前vue.3.x还处于beta状态,官方的英文文档v3.vuejs.org
使用tsx模式开发组件
尽管模版的写法一直是官方推荐的,除了没法支持类型提示,也没有可挑剔的了。这里选择TypeScript,所以采用tsx的模式代替template
为了实现tsx的加载,需要借助相关的loader插件 @ant-design-vue/babel-plugin-jsx、HcySunYang/vue-next-jsx
The text was updated successfully, but these errors were encountered: