本文整理汇总了TypeScript中react.DOM类的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM类的具体用法?TypeScript DOM怎么用?TypeScript DOM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DOM类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: render
public render() {
const mp = this.props.MP;
const choice = this.props.choice;
const choices = choiceEnum;
const reactChoices = [];
forEach(choices, (c) => {
if (choice === c) {
reactChoices.push(React.DOM.div({className: 'choice selected'},
choices[c]));
} else {
let oc = null;
if (choice === -1) {
oc = ((c) => {
return () => {
mp.move(c);
};
})(c);
}
reactChoices.push(React.DOM.div({className: 'choice', onClick: oc},
choices[c]));
}
});
const cn = choice === -1 ? 'unselected' : 'selected';
reactChoices.push(React.DOM.div({className: 'clearer'}));
return React.DOM.div({id: 'choices', className: cn}, reactChoices);
}
示例2: render
render() {
let style = { float: 'left', width: '500px' };
let { state } = this.props;
return DOM.div(
{ style },
DOM.label({}, `${this.props.name} ${this.props.data.length}`),
DOM.ol({}, this.props.data.map(this.renderItem)))
}
示例3: render
function render() {
ReactDOM.render(
React.DOM.text(42),
valueEl
)
//valueEl.innerHTML = store.getState().toString()
}
示例4: forEach
forEach(choices, (c) => {
if (choice === c) {
reactChoices.push(React.DOM.div({className: 'choice selected'},
choices[c]));
} else {
let oc = null;
if (choice === -1) {
oc = ((c) => {
return () => {
mp.move(c);
};
})(c);
}
reactChoices.push(React.DOM.div({className: 'choice', onClick: oc},
choices[c]));
}
});
示例5: function
render: function () : void {
return D.div({},
D.span({ onMouseUp: this.handleNameClick }, this.props.name),
": ",
React.DOM.input({ type: "text",
ref: "input",
onChange: this.doUpdate,
defaultValue:
this.props.backing.textContent,
id: this.props.parent.getName() + "-" +
this.props.name })
);
}