比如下面这个里面的?和|,是es6里面的吗,可是我看es6没看到哇?
export default class VNode {
tag: string | void;
data: VNodeData | void;
children: Array<VNode> | void;
text: string | void;
elm: Node | void;
ns: string | void;
context: Component | void; // rendered in this component's scope
key: string | number | void;
componentOptions: VNodeComponentOptions | void;
child: Component | void; // component instance
parent: VNode | void; // compoennt placeholder node
raw: boolean; // contains raw HTML? (server only)
isStatic: boolean; // hoisted static node
isRootInsert: boolean; // necessary for enter transition check
isComment: boolean; // empty comment placeholder?
isCloned: boolean; // is a cloned node?
constructor (
tag?: string,
data?: VNodeData,
children?: Array<VNode> | void,
text?: string,
elm?: Node,
ns?: string | void,
context?: Component,
componentOptions?: VNodeComponentOptions
) {
this.tag = tag
this.data = data
this.children = children
this.text = text
this.elm = elm
this.ns = ns
this.context = context
this.key = data && data.key
this.componentOptions = componentOptions
this.child = undefined
this.parent = undefined
this.raw = false
this.isStatic = false
this.isRootInsert = true
this.isComment = false
this.isCloned = false
}
}
还有下面这种?又在后面了
type PropOptions = {
type: Function | Array<Function> | null,
default: any,
required: ?boolean,
validator: ?Function
}
这个不是
es6
,是flow,一个类型检查、分析工具type: Function | Array<Function> | null,
: 表示,type
可能是Function
,也可能是Array of Function
,还可能是null
required: ?boolean,
: 表示required
是个可选参数,类型是boolean