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