本文整理汇总了TypeScript中snabbdom/vnode.vnode函数的典型用法代码示例。如果您正苦于以下问题:TypeScript vnode函数的具体用法?TypeScript vnode怎么用?TypeScript vnode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vnode函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
export function mapVNode<A, B>(f: (_: A) => B, v: VNode<A>): VNode<B> {
let data = v.data || {};
if (isThunk(v)) {
const ndata = T.assign({}, v.data, {
cofn: T.o(f, data.cofn as any)
}) as VNodeData<B>;
return T.set('data', ndata, v as any);
}
if (typeof data.cofn === 'function') {
return V.vnode(v.sel,
T.assign({}, data as any, {
cofn: T.o(f, data.cofn),
hook: {
init: initMapHook,
prepatch: prepatchMapHook
}
}),
v.children, v.text, v.elm as Element);
}
return V.vnode(v.sel,
T.assign({}, data as any, {
cofn: f,
hook: {
init: initMapHook,
prepatch: prepatchMapHook
}
}),
v.children, v.text, v.elm as Element);
}
示例2: vnode
node =>
node
? vnode(
node.sel + scope,
node.data,
node.children,
node.text,
node.elm as any,
)
: node,
示例3: wrapDocFrag
private wrapDocFrag(children: Array<VNode>) {
return vnodeFn('', {}, children, undefined, this.rootElement as any);
}
示例4: vnode
return sink.map((node: VNode) =>
vnode(node.sel + scope, node.data, node.children, node.text, node.elm as any),