generated from template/vite-react-template
feat: update new feature temp for panel
This commit is contained in:
5
template/ai-app/AiApp.tsx
Normal file
5
template/ai-app/AiApp.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export const AiApp = () => {
|
||||
return <div>AiApp</div>;
|
||||
};
|
||||
28
template/ai-app/main.tsx
Normal file
28
template/ai-app/main.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { createRoot, Root } from 'react-dom/client';
|
||||
import { AiApp } from './AiApp';
|
||||
import { app, initAIAppRootOrCreate, useContextKey } from '../app';
|
||||
import { Editor } from '@/pages/editor/index';
|
||||
import { ExampleApp } from '@/modules/panels/Example';
|
||||
initAIAppRootOrCreate();
|
||||
|
||||
app
|
||||
.route({
|
||||
path: 'ai',
|
||||
key: 'render',
|
||||
description: '渲染AI应用',
|
||||
run: async (ctx) => {
|
||||
const root = initAIAppRootOrCreate();
|
||||
console.log('ai render');
|
||||
console.log('ai render', root);
|
||||
if (!root) {
|
||||
return;
|
||||
}
|
||||
const aiRoot = createRoot(root!);
|
||||
// aiRoot.render(<Editor />);
|
||||
// aiRoot.render(<AiApp />);
|
||||
aiRoot.render(<ExampleApp />);
|
||||
useContextKey('aiRoot', () => aiRoot, true);
|
||||
ctx.body = 'aiRoot';
|
||||
},
|
||||
})
|
||||
.addTo(app);
|
||||
Reference in New Issue
Block a user