本文整理汇总了TypeScript中preact.h函数的典型用法代码示例。如果您正苦于以下问题:TypeScript h函数的具体用法?TypeScript h怎么用?TypeScript h使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了h函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: render
render() {
if (!this.state.latest) {
return h(Loading, null);
}
const notebookList = this.state.latest.map(info => {
const snippit = info.doc.cells.map(normalizeCode)
.join("\n")
.slice(0, 100);
const href = nbUrl(info.nbId);
return h("li", null,
h("a", { href },
notebookBlurb(info.doc, false),
snippit
),
);
});
return h("div", { "class": "most-recent" },
h("button", {
"class": "create-notebook",
"onClick": () => this.onCreate(),
}, "Create Empty Notebook"),
h("h2", null, "Recently Updated"),
h("ol", null, ...notebookList),
);
}
示例2: div
export const PropelIndex = (props) => {
return div("index",
h(Splash, props),
h(Intro, null),
h(UseIt, null),
h(Perks, null),
h(ReferencesFooter, null),
);
};
示例3: readFileSync
export const References = (props) => {
const refhtml = readFileSync(__dirname + "/references.html", "utf8");
return div("references",
h(GlobalHeader, { subtitle: "References" }),
p("This work is inspired by and built upon great technologies."),
h("div", {
dangerouslySetInnerHTML: { __html: refhtml },
}),
);
};
示例4: GlobalHeader
export function GlobalHeader(props) {
return h("div", { "class": "global-header" },
h("div", { "class": "global-header-inner" },
h(PropelLogo, {
subtitle: props.subtitle,
subtitleLink: props.subtitleLink,
}),
h("div", { "class": "global-header-right" }, ...props.children)
),
);
}
示例5: notebookBlurb
function notebookBlurb(doc: db.NotebookDoc, showDates = true): JSX.Element {
const dates = !showDates ? [] : [
h("p", { "class": "created" }, `Created ${fmtDate(doc.created)}.`),
h("p", { "class": "updated" }, `Updated ${fmtDate(doc.updated)}.`),
];
return h("div", { "class": "blurb" }, null, [
h(Avatar, { userInfo: doc.owner }),
h("p", { "class": "displayName" }, doc.owner.displayName),
...dates
]);
}
示例6: nbUrl
const notebookList = this.state.latest.map(info => {
const snippit = info.doc.cells.map(normalizeCode)
.join("\n")
.slice(0, 100);
const href = nbUrl(info.nbId);
return h("li", null,
h("a", { href },
notebookBlurb(info.doc, false),
snippit
),
);
});