From 50903bb27362593db2a4555f1cd3317cfddfd90f Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Mon, 27 May 2024 11:14:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(app):=20=E8=A7=A3=E5=86=B3=20UniComponent?= =?UTF-8?q?=20=E5=BE=AA=E7=8E=AF=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/dom/components/UniComponent.ts | 3 ++- .../src/view/framework/dom/components/index.ts | 16 +--------------- .../src/view/framework/dom/createWrapper.ts | 10 ++++++++++ packages/uni-components/src/vue/image/index.tsx | 15 +++++++-------- 4 files changed, 20 insertions(+), 24 deletions(-) create mode 100644 packages/uni-app-plus/src/view/framework/dom/createWrapper.ts diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts index b025d28ec2..bf71c10e54 100644 --- a/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts +++ b/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts @@ -19,7 +19,8 @@ import { } from '@dcloudio/uni-shared' import { UniNode } from '../elements/UniNode' import { createInvoker, createWxsEventInvoker } from '../modules/events' -import { type UniCustomElement, createWrapper } from '.' +import type { UniCustomElement } from '.' +import { createWrapper } from '../createWrapper' import { $, removeElement } from '../store' import { JOB_PRIORITY_REBUILD, diff --git a/packages/uni-app-plus/src/view/framework/dom/components/index.ts b/packages/uni-app-plus/src/view/framework/dom/components/index.ts index 8ff6ed9836..c71fe78520 100644 --- a/packages/uni-app-plus/src/view/framework/dom/components/index.ts +++ b/packages/uni-app-plus/src/view/framework/dom/components/index.ts @@ -1,10 +1,5 @@ import type { ComponentDescriptorVm } from '@dcloudio/uni-core' -import { - type ComponentInternalInstance, - type ComponentPublicInstance, - type defineComponent, - h, -} from 'vue' +import type { ComponentInternalInstance, ComponentPublicInstance } from 'vue' import { UniComment } from '../elements/UniComment' import { UniTextElement } from '../elements/UniTextElement' import { UniTextNode } from '../elements/UniTextNode' @@ -111,12 +106,3 @@ export const BuiltInComponents = { VIDEO: UniVideo, 'WEB-VIEW': UniWebView, } as const - -export type WrapperComponent = ReturnType - -export function createWrapper( - component: ReturnType, - props: Record -) { - return () => h(component, props) -} diff --git a/packages/uni-app-plus/src/view/framework/dom/createWrapper.ts b/packages/uni-app-plus/src/view/framework/dom/createWrapper.ts new file mode 100644 index 0000000000..e50330836e --- /dev/null +++ b/packages/uni-app-plus/src/view/framework/dom/createWrapper.ts @@ -0,0 +1,10 @@ +import { type defineComponent, h } from 'vue' + +export type WrapperComponent = ReturnType + +export function createWrapper( + component: ReturnType, + props: Record +) { + return () => h(component, props) +} diff --git a/packages/uni-components/src/vue/image/index.tsx b/packages/uni-components/src/vue/image/index.tsx index 03b352ae2e..d3f0be179e 100644 --- a/packages/uni-components/src/vue/image/index.tsx +++ b/packages/uni-components/src/vue/image/index.tsx @@ -1,17 +1,17 @@ import { - ref, - Ref, - watch, + type ExtractPropTypes, + type Ref, computed, - reactive, - onMounted, onBeforeUnmount, - ExtractPropTypes, + onMounted, + reactive, + ref, + watch, } from 'vue' import { getRealPath } from '@dcloudio/uni-platform' import { defineBuiltInComponent } from '../../helpers/component' import { UniElement } from '../../helpers/UniElement' -import { CustomEventTrigger, useCustomEvent } from '../../helpers/useEvent' +import { type CustomEventTrigger, useCustomEvent } from '../../helpers/useEvent' import ResizeSensor from '../resize-sensor/index' const props = { @@ -100,7 +100,6 @@ export default /*#__PURE__*/ defineBuiltInComponent({
{FIX_MODES[props.mode as keyof typeof FIX_MODES] ? ( - // @ts-ignore ) : ( -- GitLab