import React, { Component } from 'react' ; class App extends Component { showMsg(){ alert( "来自react问候!" ); } render() { return ( <div classname= "App" > <button onclick= "{this.showMsg}" >按钮</button> </div> ); } } export default App; |