Comments (3)
vue-next jsx进展
尤大在关于vue/jsx的回复 vuejs/jsx/issues/141#issuecomment-658304273,尽可能少的添加语法糖到jsx中,因为选择使用jsx的用户未必一定使用模版语法
I've seen some great discussions here, while I don't have definitive answers to all the questions yet, I'll just write down some of my thoughts here:
-
I don't think we should add too much syntax sugar into JSX. If we do, we should do it in a type-safe and JSX-idiomatic fashion (i.e camelCase). For example I like the idea of vModel={[val, [modifiers]]}.
-
If we can agree on a type-safe usage for directives and event handlers, then I think we should later remove template-like syntax like v-on-click_stop, v-model_number or vModel_trim - they create extra complexities for typing, another way of doing things, plus JSX is for users who don't want to use templates anyway, so what's the point in making it look like templates?
在官方提供最新版本支持前、可以使用上面的两个社区的解决方案
from blog.
期待vue jsx能够得到jsx官方的支持
jsx刚开始在react中对类型的支持也不好,后来react和ts团队合作再有了现在的完美支持。
Edit by @yyx990803 : there are currently two JSX transform implementations for Vue 3 with slightly differing syntax (for Vue specific features). We are using this thread to unify the design and land on an official specification of how Vue features should be handled in JSX.
希望能够得到jsx官方的支持
from blog.
Vue3.x使用TypeScript
Vue对具有type定义的道具进行运行时验证。为了将这些类型提供给TypeScript,我们需要使用以下方法强制转换构造函数PropType:
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
from blog.
Related Issues (5)
- 日常踩坑记录(1) HOT 6
- 从零开始配置webpack react开发环境
- 前端项目的代码风格校验相关配置 HOT 1
- 日常踩坑记录(2) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog.