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