shareQR.jsx 494 B

1234567891011121314151617181920212223242526
  1. import React from 'react'
  2. import QRCode from 'qrcode.react'
  3. class ShareQR extends React.Component {
  4. constructor(props) {
  5. super(props)
  6. this.state = {
  7. url: ""
  8. }
  9. }
  10. componentDidMount(){
  11. this.setState({
  12. url: "http://www.baidu.com/"
  13. })
  14. }
  15. render(){
  16. return(
  17. <div>
  18. <QRCode size={150} value={this.state.url} level={"L"}/>
  19. </div>
  20. )
  21. }
  22. }
  23. export default ShareQR