Skip to content

Commit

Permalink
feat: my增加canvasReady&reRender
Browse files Browse the repository at this point in the history
  • Loading branch information
xuying.xu committed Sep 25, 2024
1 parent 672c288 commit 5fbc5d6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/f-my/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Component({
width: null,
height: null,
onError: () => {},
onCanvasReady: () => {},
onreRender: () => {},
type: '2d', // canvas 2d, 基础库 2.7 以上支持
},
/**
Expand Down Expand Up @@ -83,6 +85,8 @@ Component({
this.setData({ id });
},
onCanvasReady() {
const { onCanvasReady } = this.props;
onCanvasReady && onCanvasReady();
const { id } = this.data;
const query = my.createSelectorQuery();
query
Expand Down Expand Up @@ -149,7 +153,7 @@ Component({
if (!width || !height) {
return;
}
const { theme, px2hd } = this.props;
const { theme, px2hd, onreRender } = this.props;
const children = this.props.onRender(this.props);
const canvas = new Canvas({
pixelRatio,
Expand All @@ -162,6 +166,7 @@ Component({
createImage,
requestAnimationFrame,
cancelAnimationFrame,
onRender: onreRender,
// @ts-ignore
offscreenCanvas: my.createOffscreenCanvas(),
useNativeClickEvent: false,
Expand Down

0 comments on commit 5fbc5d6

Please sign in to comment.