appDemo/templates/index.html
2024-07-02 23:47:32 +08:00

37 lines
1.0 KiB
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="{{ url_for('static', filename='css/sdk.css') }}" />
</head>
<body>
<div id="root"></div>
<script src="{{ url_for('static', filename='js/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>