From 7ff160e1d7adeeeea04011a17b0510387c917f48 Mon Sep 17 00:00:00 2001 From: satori Date: Sat, 7 Dec 2024 06:57:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/main.js b/main.js index afbae56..d94d605 100644 --- a/main.js +++ b/main.js @@ -3,7 +3,6 @@ import { createElement, div, table, thead, tbody, tr, th, td } from '@laniakeasu const rest = await fetch('http://localhost:2000/api').then(res => res.json()) document.body.appendChild(div.childs([ - div.text('航班信息'), table.childs([ thead.childs([ tr.childs([ @@ -29,14 +28,8 @@ document.body.appendChild(div.childs([ ])) const metrics = await fetch('http://localhost:2000/api/metrics').then(res => res.json()) +const context = createElement({ width: 800, height: 200 }, 'canvas') -// 创建图表 -const context = createElement({ - width: 800, - height: 200, -}, 'canvas') - -document.body.appendChild(context) new Chart(context, { type: 'line', data: { @@ -58,4 +51,6 @@ new Chart(context, { } } } -}) \ No newline at end of file +}) + +document.body.appendChild(context)