feat:架构代码优化
This commit is contained in:
@@ -7,6 +7,6 @@
|
||||
"usingComponents": {
|
||||
"toy-button": "../../ui/button/button",
|
||||
"share-guide-popup": "../../components/share-guide-popup/share-guide-popup",
|
||||
"math-bottom-buttons": "../components/math-bottom-buttons/math-bottom-buttons"
|
||||
"math-bottom-buttons": "../shared/components/math-bottom-buttons/math-bottom-buttons"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
@import '../common/mathPage.less';
|
||||
@import '../shared/common/mathPage.less';
|
||||
@@ -1,15 +1,12 @@
|
||||
import CompareDraw from '../service/compareDraw';
|
||||
import CompareDraw from '../shared/service/compareDraw';
|
||||
import {
|
||||
getMathPageCommonMethods,
|
||||
createMathPage,
|
||||
CanvasDataState,
|
||||
} from '../common/mathPageMixin';
|
||||
} from '../shared/common/mathPageMixin';
|
||||
|
||||
// 获取公共方法
|
||||
const commonMethods = getMathPageCommonMethods({
|
||||
pagePath: 'compare/compare',
|
||||
});
|
||||
// 获取公共方
|
||||
|
||||
Page({
|
||||
createMathPage({
|
||||
canvas: null as Canvas | null,
|
||||
ctx: null as RenderingContext | null,
|
||||
boxHeight: 0,
|
||||
@@ -40,7 +37,11 @@ Page({
|
||||
|
||||
onReady() {
|
||||
this.initCanvas({
|
||||
createDrawService: (canvas, ctx, options) => {
|
||||
createDrawService: (
|
||||
canvas: Canvas,
|
||||
ctx: RenderingContext,
|
||||
options?: Record<string, any>,
|
||||
) => {
|
||||
return new CompareDraw(canvas, ctx, options);
|
||||
},
|
||||
drawServiceOptions: {
|
||||
@@ -120,13 +121,4 @@ Page({
|
||||
|
||||
this.compareData = { problems };
|
||||
},
|
||||
|
||||
// ========== 使用公共方法 ==========
|
||||
initCanvas: commonMethods.initCanvas,
|
||||
exportToPrint: commonMethods.exportToPrint,
|
||||
onShareAppMessage: commonMethods.onShareAppMessage,
|
||||
onShareTimeline: commonMethods.onShareTimeline,
|
||||
onCloseShareDialog: commonMethods.onCloseShareDialog,
|
||||
onShareSuccess: commonMethods.onShareSuccess,
|
||||
initPageInfo: commonMethods.initPageInfo,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user