feat: 同步更新
This commit is contained in:
parent
a26d500ab3
commit
1ed74602d5
|
@ -1,9 +1,8 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Picture } from 'yunzai/utils'
|
import { Picture } from 'yunzai/utils'
|
||||||
import { type PropsType } from './views/hello.tsx'
|
import * as hello from './views/hello.tsx'
|
||||||
import { createDynamicComponent } from 'yunzai/utils'
|
import { createDynamicComponent } from 'yunzai/utils'
|
||||||
const dynamic = createDynamicComponent(import.meta.url)
|
const dynamic = createDynamicComponent(import.meta.url)
|
||||||
|
|
||||||
export class Image extends Picture {
|
export class Image extends Picture {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
|
@ -16,9 +15,8 @@ export class Image extends Picture {
|
||||||
* @param Props 组件参数
|
* @param Props 组件参数
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async createHello(uid: number, Props: PropsType) {
|
async createHello(uid: number, Props: Parameters<typeof hello.default>[0]) {
|
||||||
// 非生产环境将触发动态组件效果
|
const Hello = (await dynamic<typeof hello>('./views/hello.tsx')).default
|
||||||
const { default: Hello } = (await dynamic<'default', PropsType>('./views/hello.tsx'))
|
|
||||||
// 生成 html 地址 或 html字符串
|
// 生成 html 地址 或 html字符串
|
||||||
const Address = this.Com.create(<Hello {...Props} />, {
|
const Address = this.Com.create(<Hello {...Props} />, {
|
||||||
// html/hello/uid.html
|
// html/hello/uid.html
|
||||||
|
|
|
@ -17,6 +17,18 @@ export type PropsType = {
|
||||||
const require = createRequire(import.meta.url)
|
const require = createRequire(import.meta.url)
|
||||||
const url: string = require('../resources/example.png')
|
const url: string = require('../resources/example.png')
|
||||||
|
|
||||||
|
|
||||||
|
export function Post({ url }: { url: string }) {
|
||||||
|
return (
|
||||||
|
<section className="flex flex-col">
|
||||||
|
<div className="divide-y divide-slate-100 m-8 shadow-2xl">
|
||||||
|
<img className="h-40 w-40" src={url}></img>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param param0
|
* @param param0
|
||||||
|
|
Loading…
Reference in New Issue