feat: 同步新版
This commit is contained in:
parent
5e0c0dc756
commit
2fd18f564b
12
image.tsx
12
image.tsx
|
@ -1,8 +1,9 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { Picture } from 'yunzai/utils'
|
import { Picture } from 'yunzai/utils'
|
||||||
import { PropsType } from './views/hello.tsx'
|
import { type PropsType } from './views/hello.tsx'
|
||||||
import { createDynamic } from 'yunzai/utils'
|
import { createDynamicComponent } from 'yunzai/utils'
|
||||||
const require = createDynamic(import.meta.url)
|
const dynamic = createDynamicComponent(import.meta.url)
|
||||||
|
|
||||||
export class Image extends Picture {
|
export class Image extends Picture {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
|
@ -17,9 +18,7 @@ export class Image extends Picture {
|
||||||
*/
|
*/
|
||||||
async createHello(uid: number, Props: PropsType) {
|
async createHello(uid: number, Props: PropsType) {
|
||||||
// 非生产环境将触发动态组件效果
|
// 非生产环境将触发动态组件效果
|
||||||
const Hello = (
|
const { default: Hello } = (await dynamic<'default', PropsType>('./views/hello.tsx'))
|
||||||
await require('./views/hello.tsx', process.env.NODE_ENV != 'production')
|
|
||||||
).default
|
|
||||||
// 生成 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
|
||||||
|
@ -29,5 +28,6 @@ export class Image extends Picture {
|
||||||
return this.Pup.render(Address)
|
return this.Pup.render(Address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化 图片生成对象
|
// 初始化 图片生成对象
|
||||||
export const imgae = new Image()
|
export const imgae = new Image()
|
|
@ -1,9 +1,9 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { movies } from './data'
|
import { movies } from './data'
|
||||||
import { createDynamic } from 'yunzai/utils'
|
import { createDynamic } from 'yunzai/utils'
|
||||||
const require = createDynamic(import.meta.url)
|
const dynamic = createDynamic(import.meta.url)
|
||||||
const Hello = (await require('./views/hello.tsx')).default
|
const Hello = (await dynamic('./views/hello.tsx')).default
|
||||||
const Music = (await require('./views/music.tsx')).default
|
const Music = (await dynamic('./views/music.tsx')).default
|
||||||
const Config = [
|
const Config = [
|
||||||
{
|
{
|
||||||
url: '/hello',
|
url: '/hello',
|
||||||
|
|
Loading…
Reference in New Issue