Browse Source

master

master
邓宏 3 years ago
parent
commit
41cc1631fa
  1. 2
      src/views/About.vue
  2. 20
      src/views/Demo.vue
  3. 126
      src/views/Home.vue

2
src/views/About.vue

@ -1,6 +1,6 @@
<template> <template>
<div class="about"> <div class="about">
<h1></h1> <h1>about</h1>
</div> </div>
</template> </template>
<script> <script>

20
src/views/Demo.vue

@ -1,19 +1,15 @@
<template> <template>
<div> <div>
<h1>demo</h1> <h1>demo---{{value}} ---{{name}}</h1>
<button @click="$router.back()">上一页</button> <button @click="$router.back()">上一页</button>
</div> </div>
</template> </template>
<script> <script setup>
import { defineComponent,onActivated } from 'vue' import { defineProps, defineEmits, ref, useSSRContext,useAttrs, useSlots } from 'vue'
const props = defineProps({
export default defineComponent({ name:String
name:"demo",
setup() {
onActivated(()=>{
console.log("------onActivated-----------------demo---------")
})
console.log("--------------demo-------------")
},
}) })
console.log(useSSRContext(console.log),'--------ctx---')
const value=ref(props.name)
console.log(defineEmits(['childClick']))
</script> </script>

126
src/views/Home.vue

@ -20,70 +20,70 @@ export default defineComponent({
} }
onMounted(()=>{ onMounted(()=>{
window._AMapSecurityConfig={ // window._AMapSecurityConfig={
securityJsCode:"3eceddef3eafbf06e01107c78db2c264", // securityJsCode:"3eceddef3eafbf06e01107c78db2c264",
} // }
AMapLoader.load({key:"3b999eeef15d7b6ca6a3fd0c9531160d",version:"2.0",plugins:["AMap.PolygonEditor,AMap.AutoComplete"]}).then(AMap=>{ // AMapLoader.load({key:"3b999eeef15d7b6ca6a3fd0c9531160d",version:"2.0",plugins:["AMap.PolygonEditor,AMap.AutoComplete"]}).then(AMap=>{
map=new AMap.Map(_data.map.value,{ // map=new AMap.Map(_data.map.value,{
viewMode:"3D", // viewMode:"3D",
zoom:16, // zoom:16,
zooms:[13,16.75], // zooms:[13,16.75],
center:[103.144875, 25.482653], // center:[103.144875, 25.482653],
layers:[ // layers:[
// // //
new AMap.TileLayer.Satellite(), // new AMap.TileLayer.Satellite(),
// // //
new AMap.TileLayer.RoadNet() // new AMap.TileLayer.RoadNet()
], // ],
}) // })
window.m=map // window.m=map
// // //
var polygon=new AMap.Polygon({ // var polygon=new AMap.Polygon({
path:[ // path:[
[103.154206, 25.482612], // [103.154206, 25.482612],
[103.154297, 25.482324], // [103.154297, 25.482324],
[103.154146, 25.481694], // [103.154146, 25.481694],
[103.15457, 25.481461], // [103.15457, 25.481461],
[103.154813, 25.482379], // [103.154813, 25.482379],
[103.154555, 25.482448] // [103.154555, 25.482448]
], // ],
strokeColor: "#FF33FF", // strokeColor: "#FF33FF",
strokeWeight: 1, // strokeWeight: 1,
strokeOpacity: 0.7, // strokeOpacity: 0.7,
fillOpacity: 0.2, // fillOpacity: 0.2,
fillColor: '#1791fc', // fillColor: '#1791fc',
zIndex: 50, // zIndex: 50,
}) // })
var polygon1=new AMap.Polygon({ // var polygon1=new AMap.Polygon({
path:[ // path:[
[103.145047, 25.483922], // [103.145047, 25.483922],
[103.149596, 25.483689], // [103.149596, 25.483689],
[103.145798, 25.480222], // [103.145798, 25.480222],
], // ],
strokeColor: "#FF33FF", // strokeColor: "#FF33FF",
strokeWeight: 3, // strokeWeight: 3,
strokeOpacity: 0.7, // strokeOpacity: 0.7,
fillOpacity: 0.2, // fillOpacity: 0.2,
fillColor: '#1791fc', // fillColor: '#1791fc',
zIndex: 60, // zIndex: 60,
}) // })
map.add([polygon,polygon1]) // map.add([polygon,polygon1])
var polyEditor=new AMap.PolygonEditor(map) // var polyEditor=new AMap.PolygonEditor(map)
polyEditor.on("end",res=>{ // polyEditor.on("end",res=>{
console.log("---------end-------------") // console.log("---------end-------------")
}) // })
// polyEditor.open() // // polyEditor.open()
var auto = new AMap.AutoComplete({ // var auto = new AMap.AutoComplete({
input:"search", // input:"search",
}); // });
setTimeout(()=>{ // setTimeout(()=>{
auto.search('北京',(a,b)=>{ // auto.search('',(a,b)=>{
console.log(a,"-------aaaaaa----------") // console.log(a,"-------aaaaaa----------")
console.log(b,"----------bbbbbbb---------") // console.log(b,"----------bbbbbbb---------")
}) // })
},1000) // },1000)
}) // })
}) })
return _data; return _data;
}, },

Loading…
Cancel
Save