simple.tsx 564 B

123456789101112131415161718192021222324252627
  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import styled from 'styled-components';
  4. import { PhotoView } from '../src';
  5. const Container = styled.div`
  6. font-size: 32px;
  7. `;
  8. const Header = styled.header`
  9. padding: 40px;
  10. font-size: 32px;
  11. border-bottom: 1px solid #ccc;
  12. `;
  13. class Example extends React.Component {
  14. render() {
  15. return (
  16. <Container>
  17. <Header>React 图片预览组件</Header>
  18. <PhotoView src="example.png" />
  19. </Container>
  20. );
  21. }
  22. }
  23. ReactDOM.render(<Example />, document.getElementById('root'));