appDemo/amis-flask-pywebview-demo/web/index.html
2024-07-03 22:09:45 +08:00

37 lines
987 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AMIS 示例</title>
<link rel="stylesheet" href="sdk.css" />
</head>
<body>
<div id="root"></div>
<script src="sdk.js"></script>
<script>
async function fetchConfig() {
try {
const response = await fetch('/api/config');
if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText);
}
const config = await response.json();
renderAmis(config);
} catch (error) {
console.error('Fetch error:', error);
}
}
function renderAmis(config) {
let amis = amisRequire('amis/embed');
amis.embed('#root', config);
}
// 获取并渲染配置
fetchConfig();
</script>
</body>
</html>