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