This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onMounted(() => { | |
if (window.ov) { | |
terrainview = new window.ov.TerrainView("map"); | |
window.terrainview = terrainview; | |
// 開啟地形檔 | |
terrainview.openTerrain({ | |
url: "https://t-klport-map.insynerger.com", | |
identifier: "terrain", | |
callback: openMapResEvent, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
<style> | |
body{ | |
margin: 0; | |
padding: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//引入 React 及 Component | |
import React, {Component} from 'react' | |
//建立一個名為 App 的類別並繼承 Component | |
class App extends Component{ | |
//初始化結構,學過其他程式的話可以當作建構子 | |
constructor(props){ | |
super(props) //super() 繼承父類別的結構,類似java中的super()或C#中的base() | |
this.state = { //設定在 App 這個類別中要使用的 state | |
count: 1 //跟寫 js 的 object一樣方法 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//引入 React 及 Component | |
import React, {Component} from 'react' | |
//建立一個名為 App 的類別並繼承 Component | |
class App extends Component{ | |
render(){ | |
return ( | |
<div>Hello React</div> | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1 | |
document.getElementById('myDiv').addEventListener('click', function(){alert('clicked')}) | |
//2 | |
document.getElementById('myDiv').onclick = ()=>{alert('clicked')} | |
//3 | |
<div id='myDiv' onclick='myDivClick'>按我</div> | |
function myDivClick(){ | |
alert('clicked') |