赞
踩
<body> <div id="test"></div> <script type="text/babel"> "use strict"; class Life extends React.Component { death = () => { ReactDOM.unmountComponentAtNode(document.getElementById("test")); }; render() { return ( <div> <h2>字段</h2> <button onClick={this.death}>卸载该组件</button> </div> ); } } ReactDOM.render(<Life />, document.getElementById("test")); </script> </body>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。