简写
This commit is contained in:
		
							
								
								
									
										13
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								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())
 | 
					const rest = await fetch('http://localhost:2000/api').then(res => res.json())
 | 
				
			||||||
document.body.appendChild(div.childs([
 | 
					document.body.appendChild(div.childs([
 | 
				
			||||||
    div.text('航班信息'),
 | 
					 | 
				
			||||||
    table.childs([
 | 
					    table.childs([
 | 
				
			||||||
        thead.childs([
 | 
					        thead.childs([
 | 
				
			||||||
            tr.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 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, {
 | 
					new Chart(context, {
 | 
				
			||||||
    type: 'line',
 | 
					    type: 'line',
 | 
				
			||||||
    data: {
 | 
					    data: {
 | 
				
			||||||
@@ -58,4 +51,6 @@ new Chart(context, {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					document.body.appendChild(context)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user