本文整理匯總了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),