Files
bim_engine/demo.html
2025-12-03 12:00:46 +08:00

34 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BIM Engine SDK Demo</title>
<script src="./dist/bim-engine-sdk.umd.js"></script>
</head>
<body>
<div id="app" style="width: 100%; height: 300px; border: 1px dashed #ccc;"></div>
<script>
// 等待 SDK 加载
window.onload = () => {
if (window.BimEngineSDK) {
// 这里的 BimEngineSDK 是 UMD 的全局变量名(由 vite.config.ts 中的 build.lib.name 定义)
// 如果是 export default可能直接挂载在 window.BimEngineSDK或者需要 .default取决于打包格式。
// 但我们在 index.ts 中使用了具名导出 export { BimEngine },所以应该是 window.BimEngineSDK.BimEngine
const Engine = window.BimEngineSDK.BimEngine;
try {
const instance = new Engine(document.getElementById('app'));
console.log('Engine initialized:', instance);
} catch (err) {
console.error('Init failed:', err);
}
} else {
console.error('SDK not found');
}
};
</script>
</body>
</html>