Blobt
4 years ago
4 changed files with 64 additions and 21 deletions
-
1public/index.html
-
21src/App.tsx
-
41src/components/Render.tsx
-
22src/renderi/commons/HttpRequest.ts
@ -0,0 +1,41 @@ |
|||
import React from "react"; |
|||
import { HttpRequest } from "../renderi/commons/HttpRequest"; |
|||
|
|||
interface RenderProps { |
|||
name: string |
|||
} |
|||
|
|||
class Render extends React.Component<RenderProps> { |
|||
|
|||
//eslint-disable-next-line
|
|||
constructor(prop) { |
|||
super(prop); |
|||
} |
|||
|
|||
componentDidMount() { |
|||
let canvas: HTMLCanvasElement | null = document.getElementById('render') as HTMLCanvasElement; |
|||
console.log(canvas) |
|||
|
|||
let ret = HttpRequest.loadImg("https://3dresource.aihomee.com/uploads/image/2021-04-09/original/202104091701593415.jpg"); |
|||
|
|||
ret.then((data) => { |
|||
let path:string = URL.createObjectURL(data); |
|||
document.querySelector('#ig')?.setAttribute("src",path); |
|||
}); |
|||
|
|||
} |
|||
|
|||
render() { |
|||
return <> |
|||
<div> |
|||
{this.props.name} |
|||
<canvas id="render" width="800" height="600" style={{ backgroundColor: 'lightgray' }}> </canvas> |
|||
<img src="" alt="test" id="ig" /> |
|||
</div> |
|||
</>; |
|||
} |
|||
} |
|||
|
|||
//lightgray
|
|||
|
|||
export default Render; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue