From de5f43c616ca9c7a1422523cda919f42c98542b0 Mon Sep 17 00:00:00 2001 From: Treecat Date: Mon, 8 May 2023 14:36:18 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-14316=20fix:=E8=A3=85=E9=A5=B0=E5=99=A8?= =?UTF-8?q?=E7=BC=BA=E4=BA=86service?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/decorator.js | 40 ++++++++------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/packages/fineui/src/core/decorator.js b/packages/fineui/src/core/decorator.js index 31f5920c2..589a67367 100644 --- a/packages/fineui/src/core/decorator.js +++ b/packages/fineui/src/core/decorator.js @@ -1,33 +1,17 @@ -// export * from "../../typescript/core/decorator/decorator.ts"; +import * as inject from "./5.inject"; -import { shortcut as biShortcut, provider as biProvider, model as biModel, Models } from "./5.inject"; - -/** - * 注册widget - */ -export function shortcut() { - return function decorator(Target) { - biShortcut(Target.xtype, Target); - }; -} - -/** - * 注册provider - */ -export function provider() { - return function decorator(Target) { - biProvider(Target.xtype, Target); +const transFunc2Decorator = targetFunc => { + return function () { + return function decorator(Target) { + targetFunc(Target.xtype, Target); + }; }; -} +}; -/** - * 注册model - */ -export function model() { - return function decorator(Target) { - biModel(Target.xtype, Target); - }; -} +export const shortcut = transFunc2Decorator(inject.shortcut); +export const service = transFunc2Decorator(inject.service); +export const provider = transFunc2Decorator(inject.provider); +export const model = transFunc2Decorator(inject.model); /** * 类注册_store属性 @@ -40,7 +24,7 @@ export function store(Model, opts = {}) { _store() { const props = opts.props ? opts.props.apply(this) : undefined; - return Models.getModel(Model.xtype, props); + return inject.Models.getModel(Model.xtype, props); } }; };