index.vue
<template>
<view class="content">
<view class="map-title">地图测试</view>
<view class="map">
<map @tap="mapClick()" :latitude="latitude" :longitude="longitude"></map>
</view>
</view>
</template>
<script>
export default {
data() {
return {
latitude: 40.75815,
longitude: -73.97883,
}
},
methods: {
mapClick() {
uni.navigateTo({
url: '../map-detial/map-detial'
})
}
}
}
</script>
<style>
map {
width: 100%;
height: 300rpx;
}
</style>
map-detail.vue
<template>
<view class="content">
<view class="map-title">地图测试</view>
<view class="map">
<map @tap="mapClick()" :latitude="latitude" :longitude="longitude"></map>
</view>
</view>
</template>
<script>
export default {
data() {
return {
latitude: 40.75815,
longitude: -73.97883,
}
},
methods: {
mapClick() {
}
}
}
</script>
<style>
map {
width: 100%;
height: 300rpx;
}
</style>
0 个回复