本文整理汇总了TypeScript中kaiju.h函数的典型用法代码示例。如果您正苦于以下问题:TypeScript h函数的具体用法?TypeScript h怎么用?TypeScript h使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了h函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: h
const itemEls = state.items.map(item => (
h('li', { key: item }, [
h('span', String(item)),
h('input', { props: { value: 'bla' } }),
h('button', { events: { onClick: deleteRow.with(item) } }, '✕')
])
))
示例2: render
function render({ props, state }: RenderParams<Props, State>) {
const { users } = props
const { count } = state
const usersEl = users.type === 'success'
? h('ul', users.data.map(u => h('li', u)))
: h('div', 'Loading...')
return h('div', [
h('p', `count = ${count}`),
h(`button.${styles.incrementButton}`, { events: { click: increment } }, 'increment'),
fadeIn(usersEl)
])
}
示例3: return
return (children: VNode[], sel: string) => {
const props = {
key: 'groupAnimation',
animations,
hook: { prepatch }
}
return h(sel, props, children)
}
示例4: link
export default function link({ href, label, isActive = false }: LinkProps) {
return (
h('a', {
class: { [styles.link]: true, [styles.active]: isActive },
attrs: { href, 'data-nav': 'mousedown' }
}, label)
)
}
示例5: render
function render({ state }: RenderParams<Props, State>) {
const itemEls = state.items.map(item => (
h('li', { key: item }, [
h('span', String(item)),
h('input', { props: { value: 'bla' } }),
h('button', { events: { onClick: deleteRow.with(item) } }, '✕')
])
))
return h('ul', itemEls)
}
示例6: render
function render({ props }: RenderParams<Props, State>): Node[] {
const { router, route, child } = props
return [
h(`div.${style.screenLayer}`, [
h(`header.${style.header}`, [
link({
href: href(router, 'page1', { id: '33' }),
label: 'Page 1',
isActive: route.isIn('page1')
}),
link({
href: href(router, 'page2', {}),
label: 'Page 2',
isActive: route.isIn('page2')
})
]),
slideDown(child, 'main')
]),
h('div', { attrs: { 'data-popup-layer': true } })
]
}
示例7: h
const emptyVNode = () => h('div', { key: '_emptyVNode' })
示例8: h
enter: () => () => h('h1', { key: 'notFound' }, '404 :-('),
示例9: view
export default function view() {
return h('h1', { key: 'page2' }, 'Page 2')
}