From d66fe182ba0ab38ef72bfb6d829c9f794f522de5 Mon Sep 17 00:00:00 2001 From: Xc Date: Fri, 22 Apr 2022 17:31:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/.gitignore | 6 +++++- template/src/features/Sample.ts | 10 +++++----- template/src/features/index.ts | 3 ++- template/wechatMp/src/app.ts | 4 +--- template/wechatMp/src/typings/polyfill.d.ts | 9 +++++++++ 5 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 template/wechatMp/src/typings/polyfill.d.ts diff --git a/template/.gitignore b/template/.gitignore index bf78570..7bc388e 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -83,4 +83,8 @@ dist .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz -.pnp.* \ No newline at end of file +.pnp.* + +package-lock.json +src/wechatMp/dist +oak-app-domain \ No newline at end of file diff --git a/template/src/features/Sample.ts b/template/src/features/Sample.ts index e7f188b..cbf28ee 100644 --- a/template/src/features/Sample.ts +++ b/template/src/features/Sample.ts @@ -1,7 +1,7 @@ import { EntityDict } from 'oak-app-domain'; -import { Feature } from 'oak-frontend-base'; +import { Feature, BasicFeatures } from 'oak-frontend-base'; +import { RuntimeContext } from 'oak-general-business'; import { AspectDict } from '../aspects'; -import { Cache } from 'oak-frontend-base'; type DoSthAcion = { type: 'doSth', @@ -10,16 +10,16 @@ type DoSthAcion = { } } -export class Sample extends Feature { +export class Sample extends Feature, AspectDict> { get(params: any) { throw new Error('Method not implemented.'); } action(action: DoSthAcion) { throw new Error('Method not implemented.'); } - cache: Cache; + cache: BasicFeatures, AspectDict>['cache']; - constructor(cache: Cache) { + constructor(cache: BasicFeatures, AspectDict>['cache']) { super(); this.cache = cache; }; diff --git a/template/src/features/index.ts b/template/src/features/index.ts index 9eea615..8cd4d50 100644 --- a/template/src/features/index.ts +++ b/template/src/features/index.ts @@ -1,9 +1,10 @@ import { EntityDict } from 'oak-app-domain'; import { BasicFeatures } from 'oak-frontend-base'; +import { RuntimeContext } from 'oak-general-business' import * as Sample from './Sample'; import { AspectDict } from '../aspects'; -export function initialize(features: BasicFeatures) { +export function initialize(features: BasicFeatures, AspectDict>) { const { cache } = features; const sample = new Sample.Sample(cache); diff --git a/template/wechatMp/src/app.ts b/template/wechatMp/src/app.ts index 3b83786..419b5c8 100644 --- a/template/wechatMp/src/app.ts +++ b/template/wechatMp/src/app.ts @@ -1,12 +1,10 @@ -import { OakPage, OakComponent } from './init' +import './init'; export interface IAppOption { globalData: {}; } App({ globalData: { - OakPage, - OakComponent, }, async onLaunch() { console.log('onLaunch'); diff --git a/template/wechatMp/src/typings/polyfill.d.ts b/template/wechatMp/src/typings/polyfill.d.ts new file mode 100644 index 0000000..dbb37cf --- /dev/null +++ b/template/wechatMp/src/typings/polyfill.d.ts @@ -0,0 +1,9 @@ +import { MakeOakComponent, MakeOakPage } from 'oak-frontend-base'; +import { EntityDict } from 'oak-app-domain/EntityDict'; +import { RuntimeContext, aspectDict } from 'oak-general-business'; + +declare global { + const OakPage: MakeOakPage, typeof aspectDict, {}>; + const OakComponent: MakeOakComponent, typeof aspectDict, {}>; +} +export {} \ No newline at end of file