65 lines
1.5 KiB
HTML
65 lines
1.5 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 class="button" @Click="ExportKml">导出kml</button>
|
||
</div>
|
||
</body>
|
||
|
||
</html>
|
||
|
||
<script>
|
||
new Vue({
|
||
el: "#app",
|
||
data: {
|
||
sdk: null,
|
||
PolylineObject: null
|
||
},
|
||
async mounted() {
|
||
await YJ.on({
|
||
host: 'http://127.0.0.1:8888'
|
||
})
|
||
this.createEarth()
|
||
},
|
||
methods: {
|
||
async createEarth() {
|
||
this.sdk = new YJ.YJEarth("app")
|
||
let Draw = new YJ.Draw.DrawPolyline(this.sdk)
|
||
YJ.Obj.RichText.customUploadVideo = async (file) => {
|
||
console.log('调用上传视频接口,返回url')
|
||
return 'url'
|
||
}
|
||
|
||
YJ.Obj.RichText.customUploadContent = async (id, content) => {
|
||
console.log('调用上传富文本内容接口,返回url')
|
||
console.log('content', content)
|
||
return 'aaa.html'
|
||
}
|
||
Draw.start((a, positions) => {
|
||
let PolylineObject = new YJ.Obj.PolylineObject(this.sdk, { positions: positions, smooth: true })
|
||
PolylineObject.edit(true)
|
||
window.PolylineObject = PolylineObject
|
||
})
|
||
|
||
},
|
||
|
||
ExportKml() {
|
||
YJ.Global.ExportKml([this.PolylineObject])
|
||
}
|
||
}
|
||
})
|
||
</script> |