本文整理匯總了TypeScript中snabbdom/h.h函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript h函數的具體用法?TypeScript h怎麽用?TypeScript h使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了h函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: h
const QuoteMenu = (store: Store) => {
return h('div.nfe-quote-action-menu-content', [
h('ul', [
MenuItem(store, removeCurrentQuote(), 'Remove this quote'),
MenuItem(store, selectNewQuote(), 'See another quote'),
MenuItem(store, startEditing(), 'Enter custom quote...'),
]),
]);
};
示例2: h
const customQuotes = () => {
if (state.customQuotes.length > 0) {
return h('label', state.customQuotes.length + ' custom quotes');
}
return h(
'label',
'You can now add your own custom quotes! ' +
'Just click the arrow menu beside the quote text.'
);
};
示例3: h
const Icon = (svgPath: string) => (color: string) =>
h(
'svg',
{
attrs: {
x: '0px',
y: '0px',
width: '32px',
height: '32px',
viewBox: '0 0 32 32',
'enable-background': 'new 0 0 32 32',
},
},
[h('path', { attrs: { fill: color, d: svgPath } })]
);
示例4: wrap
private wrap(children: Array<VNode>) {
const {tagName, id, className} = this.rootElement;
const selId = id ? `#${id}` : '';
const selClass = className ?
`.${className.split(` `).join(`.`)}` : '';
return h(`${tagName.toLowerCase()}${selId}${selClass}`, {}, children);
}