feat: add publish app

This commit is contained in:
2024-10-07 22:28:21 +08:00
parent 8beb65e637
commit 0fc580aa38
17 changed files with 1393 additions and 722 deletions

View File

@@ -0,0 +1,46 @@
type HTMLOptions = {
title?: string;
rootId: string;
};
export const getHTML = (opts: HTMLOptions) => {
return `<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${opts.title || 'Kevisual'}</title>
<style>
html,
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
body {
font-size: 16px;
}
</style>
</head>
<body>
<div id="root"></div>
<script type="module">
import { Container } from 'https://kevisual.xiongxiao.me/root/container/index.js'
import { data } from './data.js'
const container = new Container({
root: 'root',
data: data
});
container.render('${opts.rootId}');
</script>
</body>
</html>`;
};
export const getDataJs = (result: any) => {
return 'export const data=' + JSON.stringify(result);
};