當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript virtual-dom.h函數代碼示例

本文整理匯總了TypeScript中virtual-dom.h函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript h函數的具體用法?TypeScript h怎麽用?TypeScript h使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了h函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: h

 h('.blocks', model.blocks.map(block => (
     h('.block', [
         block.title ? h('h5.block-title.small-island', block.title) : null as any,
         h('.element-groups', (
             // TODO: Use discriminated union instead, remove any
             block.elementGroups.map((elementGroup): any => {
                 if (elementGroup instanceof ImageSquarePairGroup) {
                     return h('.element-group', { className: 'image' },
                         elementGroup.elements
                             .map(renderImage)
                     );
                 } else if (elementGroup instanceof ImageGroup) {
                     return h('.element-group', { className: 'image' },
                         [elementGroup.element]
                             .map(renderImage)
                     );
                 } else if (elementGroup instanceof TextGroup) {
                     return h('.element-group', { className: 'text' }, [
                         h('.text-element.spaced-items', { innerHTML: elementGroup.element.body }, [])
                     ]);
                 }
             })
         ))
     ])
 )))
開發者ID:OliverJAsh,項目名稱:samefourchords.com,代碼行數:25,代碼來源:blocks.ts

示例2: renderForm

 private static renderForm(defaultText: string): VNode {
     return h("div", { className: "js-post-form" }, [
         h(
             "form",
             {
                 className: "form",
                 dataset: {
                     topicInlineReply: true,
                 },
             },
             [
                 h("div", { className: "container" }, [
                     h("div", { className: "form-item" }, [
                         PostForm.renderBodyFormItemLabel(),
                         PostForm.renderBodyFormItemInput(defaultText),
                     ]),
                     h("div", { className: "form-item" }, [
                         PostForm.renderPostFormItemButton(),
                         " ",
                         PostForm.renderPostFormItemBump(),
                     ]),
                 ]),
             ],
         ),
     ]);
 }
開發者ID:pxfs,項目名稱:fanboi2,代碼行數:26,代碼來源:post_form.ts

示例3: render

    public render(
        node: Node,
        configuration: ISequenceConfiguration,
        containerWidth: number,
        component: SequenceComponent,
        interaction: SequenceDOMInteraction,
        navigator: Navigator): vd.VNode {

        if (configuration.visible === false) {
            return vd.h("div.SequenceContainer", {}, []);
        }

        let nextKey: string = null;
        let prevKey: string = null;

        for (let edge of node.edges) {
            if (edge.data.direction === EdgeDirection.Next) {
                nextKey = edge.to;
            }

            if (edge.data.direction === EdgeDirection.Prev) {
                prevKey = edge.to;
            }
        }

        let playingButton: vd.VNode = this._createPlayingButton(nextKey, prevKey, configuration, component);
        let arrows: vd.VNode[] = this._createSequenceArrows(nextKey, prevKey, node, configuration, interaction, navigator);

        let containerProperties: vd.createProperties = {
            style: { height: (0.27 * containerWidth) + "px", width: containerWidth + "px" },
        };

        return vd.h("div.SequenceContainer", containerProperties, arrows.concat([playingButton]));
    }
開發者ID:Caboosey,項目名稱:mapillary-js,代碼行數:34,代碼來源:SequenceDOMRenderer.ts

示例4: _createPlayingButton

    private _createPlayingButton(
        nextKey: string,
        prevKey: string,
        configuration: ISequenceConfiguration,
        component: SequenceComponent): vd.VNode {

        let canPlay: boolean = configuration.direction === EdgeDirection.Next && nextKey != null ||
            configuration.direction === EdgeDirection.Prev && prevKey != null;

        let onclick: (e: Event) => void = configuration.playing ?
            (e: Event): void => { component.stop(); } :
            canPlay ? (e: Event): void => { component.play(); } : null;

        let buttonProperties: vd.createProperties = {
            onclick: onclick,
            style: {

            },
        };

        let iconClass: string = configuration.playing ?
            "Stop" :
            canPlay ? "Play" : "PlayDisabled";

        let icon: vd.VNode = vd.h("div.SequenceComponentIcon", { className: iconClass }, []);

        let buttonClass: string = canPlay ? "SequencePlay" : "SequencePlayDisabled";

        return vd.h("div." + buttonClass, buttonProperties, [icon]);
    }
開發者ID:Caboosey,項目名稱:mapillary-js,代碼行數:30,代碼來源:SequenceDOMRenderer.ts

示例5: h

    const renderGroupDeployNodes = (groupDeploys: List<DeployRecord>, deployGroup: DeployGroupRecord) => {
        const shouldShowProjectNames = !groupDeploys.equals(currentDeploys);

        return h(
            'li',
            { className: `deploy deploy--${deployGroup.status.split(' ').join('-').toLowerCase()}` },
            [
                h('h2', [
                    h('a', { href: createBuildLink(deployGroup.build) }, `${deployGroup.build}`)
                ]),
                // Only show project names if we have multiple deployed groups
                exp(shouldShowProjectNames) && ih('ul', {}, groupDeploys
                    .sortBy(build => build.projectName)
                    .map(deploy => {
                        const previousBuild = previousDeploysMap.get(deploy);
                        return h('li', [
                            h('a', {
                                href: createRiffRaffDeployLink(deploy.uuid),
                                title: previousBuild ? `Previous build: ${previousBuild.build}` : ''
                            }, deploy.projectName)
                        ]);
                    })
                    .toList()
                )
            ]
        );
    };
開發者ID:katebee,項目名稱:frontend,代碼行數:27,代碼來源:render.ts

示例6: renderDate

 private static renderDate(topic: Topic): VNode {
     let postedAt = new Date(topic.postedAt);
     let formatter = formatDate(postedAt);
     return h("p", { className: "topic-header-item" }, [
         "Last posted ",
         h("strong", {}, [formatter]),
     ]);
 }
開發者ID:pxfs,項目名稱:fanboi2,代碼行數:8,代碼來源:topic_view.ts

示例7: h

 posts.map((post: Post): VNode => {
     return h("div", { className: "post" }, [
         h("div", { className: "container" }, [
             PostCollectionView.renderHeader(post),
             PostCollectionView.renderBody(post),
         ]),
     ]);
 }),
開發者ID:pxfs,項目名稱:fanboi2,代碼行數:8,代碼來源:post_collection_view.ts

示例8: renderBoard

 private static renderBoard(board: Board): VNode {
     return h("div", { className: "js-board" }, [
         h("div", { className: "cascade" }, [
             h("div", { className: "container" }, [
                 BoardView.renderTitle(board),
                 BoardView.renderDescription(board),
             ]),
         ]),
     ]);
 }
開發者ID:pxfs,項目名稱:fanboi2,代碼行數:10,代碼來源:board_view.ts

示例9: h

let myForm = (store: Store<MyFormState, MyFormAction>) => {
  return h("div#myform", [
    h("input", {
      onkeyup: (event) => {
        store.dispatch(event.target.value || "")
      }
    }, store.state),
    h("span", store.state)
  ]);
}
開發者ID:tomjal,項目名稱:tsf,代碼行數:10,代碼來源:myForm.ts


注:本文中的virtual-dom.h函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。