feat: add publish app
This commit is contained in:
46
src/routes/page/module/file-template.ts
Normal file
46
src/routes/page/module/file-template.ts
Normal 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);
|
||||
};
|
||||
Reference in New Issue
Block a user