64 lines
1.6 KiB
HTML
64 lines
1.6 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<title>Title</title>
|
||
|
<script src="../sdk/YJEarth.min.js"></script>
|
||
|
<script src="vue.js"></script>
|
||
|
<style>
|
||
|
body {
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<div id="app" class="fullSize">
|
||
|
<button @click="getLocate">当前位置</button>
|
||
|
<button @click="setGroundCover">地形遮挡</button>
|
||
|
</div>
|
||
|
</body>
|
||
|
|
||
|
</html>
|
||
|
|
||
|
<script>
|
||
|
new Vue({
|
||
|
el: "#app",
|
||
|
data: {
|
||
|
status: false,
|
||
|
GroundCover: YJ.Global.getGroundCover()
|
||
|
},
|
||
|
async mounted() {
|
||
|
await YJ.on({ ws: true })
|
||
|
this.createEarth()
|
||
|
},
|
||
|
methods: {
|
||
|
async createEarth() {
|
||
|
window.sdk = await new YJ.YJEarth("app")
|
||
|
},
|
||
|
async getLocate() {
|
||
|
if (this.status) {
|
||
|
this.locate.remove()
|
||
|
this.status = false
|
||
|
}
|
||
|
else {
|
||
|
|
||
|
this.locate = await new YJ.Obj.LocateCurrent(sdk, {
|
||
|
host: '182.53.23.3:9200'
|
||
|
}, (data) => {
|
||
|
console.log(data)
|
||
|
})
|
||
|
this.status = true
|
||
|
window.locate = this.locate
|
||
|
}
|
||
|
// YJ.Global.flyTo(this.sdk, { position: { lng: 100, lat: 40 } })
|
||
|
},
|
||
|
setGroundCover() {
|
||
|
this.GroundCover = !this.GroundCover
|
||
|
YJ.Global.setGroundCover(this.GroundCover)
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
</script>
|