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