|
class App extends React.Component {
constructor(props) {
super(props);
this.menuItems = [
{
text: "Cut"
},
{
text: "Copy"
},
{
text: "Paste"
}
];
this.btnClick = this.btnClick.bind(this);
}
btnClick() {
this.cMenu.open(100, 40);
}
render() {
return (
<div className="container">
<ContextMenuComponent
id="contextmenu"
ref={scope => (this.cMenu = scope)}
items={this.menuItems}
/>
<ButtonComponent onClick={this.btnClick}>
Open ContextMenu
</ButtonComponent>
</div>
);
}
}
ReactDom.render(<App />, document.getElementById("element"));
|
open method at the
specified position with X and Y coordinates