本文整理汇总了TypeScript中dompteuse.h函数的典型用法代码示例。如果您正苦于以下问题:TypeScript h函数的具体用法?TypeScript h怎么用?TypeScript h使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了h函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: input
function input(name: string, value: string) {
return h('label', [
name,
h('input', {
props: { name },
forceProps: { value }
})
])
}
示例2: render
function render(props: Props, state: State) {
const { text } = props
const { opened } = state
return h('div.red', { class: { opened } }, [
h('button', 'Toggle'),
h('p', text)
])
}
示例3: render
function render(props: void, state: State) {
return h('div', [
h('header', [
h('a', { attrs: { href: router.link('app.index'), 'data-nav': 'mousedown' } }, 'Index'),
h('a', { attrs: { href: router.link('app.blue', { id: 33 }), 'data-nav': 'mousedown' } }, 'Blue'),
String(state.count)
]),
contentAnimation('main', getChildren(state.route))
]);
}
示例4: render
function render(props: void, state: State) {
const { id, form, redText } = state
const { firstName, lastName } = form
return h('div#green', [
`Green (route id = ${id})`,
h('form', [
input('firstName', firstName),
input('lastName', lastName)
]),
red({ text: redText })
])
}
示例5: getChildren
function getChildren(state: State) {
const { route } = state
if (route === 'app.blue') return [h('span', 'I am blue')]
if (route === 'app.blue.green') return [green()]
if (route === 'app.blue.red') return [red({ openedByDefault: true }), red()]
}
示例6: function
return function(sel: string, child: Vnode[]) {
const props: any = {
key: 'animationHook',
animations,
hook: { prepatch, postpatch }
}
return h(sel, props, child)
};
示例7: render
function render(props: void, state: State) {
const { id, route } = state
return h('div#blue', [
h('h1', 'Blue screen'),
h('a', { attrs: { href: router.link('app.blue.green', { id }), 'data-nav': 'mousedown' } }, 'Green'),
h('a', { attrs: { href: router.link('app.blue.red', { id }), 'data-nav': 'mousedown' } }, 'Red'),
h('div.increment', [
'Count: ' + state.count,
h('button', 'Increment')
]),
contentAnimation('section', getChildren(state))
])
}
示例8: function
export default function() {
return h('h1', 'Index')
}