本文整理汇总了TypeScript中inferno-create-element.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createElement
it('should mount and unmount a basic component #2', () => {
let mountCount;
let unmountCount;
class ComponentLifecycleCheck extends Component<any, any> {
render() {
return createElement('div', null,
createElement('span', null)
);
}
componentDidMount() {
mountCount++;
}
componentWillUnmount() {
unmountCount++;
}
}
mountCount = 0;
unmountCount = 0;
render(createElement(ComponentLifecycleCheck, null), container);
expect(mountCount).to.equal(1);
render(null, container);
expect(unmountCount).to.equal(1);
render(createElement(ComponentLifecycleCheck, null), container);
expect(mountCount).to.equal(2);
render(null, container);
expect(unmountCount).to.equal(2);
});
示例2:
let template = (Component, title?) =>
createElement('div', null,
createElement(Component, {
title,
name: 'Hello, World!'
})
)
示例3: createElement
const template = (val?) => createElement('select', {
multiple: true,
value: val
}, createElement('option', {
value: 1
}, 1), createElement('option', {
value: 2
}, 2));
示例4: createElement
const app = () => {
return createElement('div', null,
createElement(Button, {
type: 'button',
children: ['Do a thing']
})
);
};
示例5: createElement
it("'abc' => null", () => {
const f = document.createDocumentFragment();
const a = createElement("div", null, "abc");
const b = createElement("div", null);
render(a, f);
render(b, f);
expect((f.firstChild as Element).childNodes.length).to.equal(0);
});