37 lines
1.3 KiB
HTML
37 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<title>x-data-spreadsheet</title>
|
|
<style>
|
|
body { margin:0; padding:20px; font-family:Arial,sans-serif; background-color:#f5f5f5; }
|
|
#xspreadsheet { width:100%; height:600px; box-shadow:0 2px 10px rgba(0,0,0,0.1); background-color:white; }
|
|
</style>
|
|
<link rel="stylesheet" href="https://unpkg.com/x-data-spreadsheet@1.1.9/dist/xspreadsheet.css">
|
|
</head>
|
|
<body>
|
|
<h1>x-data-spreadsheet</h1>
|
|
<div id="xspreadsheet"></div>
|
|
|
|
<script src="https://unpkg.com/x-data-spreadsheet@1.1.9/dist/xspreadsheet.js"></script>
|
|
<script>
|
|
const sheetData = {{DATA}};
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
if (typeof x_spreadsheet === 'undefined') {
|
|
document.body.innerHTML += '<p style="color:red;margin-top:10px;">Error: x-spreadsheet library failed to load. Check internet connection.</p>';
|
|
return;
|
|
}
|
|
try {
|
|
const spreadsheet = x_spreadsheet('#xspreadsheet');
|
|
spreadsheet.loadData(sheetData);
|
|
} catch (e) {
|
|
console.error('Error:', e);
|
|
document.body.innerHTML += '<p style="color:red;margin-top:10px;">Error: ' + e.message + '</p>';
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|