From 1ed74602d5717f20f18ac24481e29be885082588 Mon Sep 17 00:00:00 2001 From: ningmengchongshui <916415899@qq.com> Date: Tue, 18 Jun 2024 13:49:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=8C=E6=AD=A5=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- image.tsx | 8 +++----- views/hello.tsx | 12 ++++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/image.tsx b/image.tsx index 32dd085..eea49cf 100644 --- a/image.tsx +++ b/image.tsx @@ -1,9 +1,8 @@ import React from 'react' import { Picture } from 'yunzai/utils' -import { type PropsType } from './views/hello.tsx' +import * as hello from './views/hello.tsx' import { createDynamicComponent } from 'yunzai/utils' const dynamic = createDynamicComponent(import.meta.url) - export class Image extends Picture { constructor() { super() @@ -16,9 +15,8 @@ export class Image extends Picture { * @param Props 组件参数 * @returns */ - async createHello(uid: number, Props: PropsType) { - // 非生产环境将触发动态组件效果 - const { default: Hello } = (await dynamic<'default', PropsType>('./views/hello.tsx')) + async createHello(uid: number, Props: Parameters[0]) { + const Hello = (await dynamic('./views/hello.tsx')).default // 生成 html 地址 或 html字符串 const Address = this.Com.create(, { // html/hello/uid.html diff --git a/views/hello.tsx b/views/hello.tsx index a7c0849..5f955d1 100644 --- a/views/hello.tsx +++ b/views/hello.tsx @@ -17,6 +17,18 @@ export type PropsType = { const require = createRequire(import.meta.url) const url: string = require('../resources/example.png') + +export function Post({ url }: { url: string }) { + return ( +
+
+ +
+
+ ) +} + + /** * * @param param0