Vue: 关于vue中的data为什么没有类型检测

Created on 26 Apr 2017  ·  1Comment  ·  Source: vuejs/vue

What problem does this feature solve?

在vue中props可以限制数据的类型,从而帮前后端省去了很多验证的麻烦,比如限制number,就只能输入数字.如果在data中也能限制类型,那么我在input上绑了一个model就可以进行类型限制,或者其他限制都是可以的

What does the proposed API look like?

great!

Most helpful comment

对于任意 data 进行运行时类型检测会带来过多性能消耗。如果你真的对类型检测有这么强的需求,不如直接用 TypeScript + Vue.

>All comments

对于任意 data 进行运行时类型检测会带来过多性能消耗。如果你真的对类型检测有这么强的需求,不如直接用 TypeScript + Vue.

Was this page helpful?
0 / 5 - 0 ratings