提交 ef1cdd55 编写于 作者: 郭胜强

feat: map组件增加slot支持

上级 06304702
<template> <template>
<uni-map <uni-map
:id="id" :id="id"
class="uni-map" /> class="uni-map">
<div
ref="map"
style="width: 100%; height: 100%; position: relative; overflow: hidden;"/>
<div
style="position: absolute; top: 0; width: 100%; height: 100%; overflow: hidden; pointer-events: none;"
>
<slot/>
</div>
</uni-map>
</template> </template>
<script> <script>
...@@ -393,7 +402,7 @@ export default { ...@@ -393,7 +402,7 @@ export default {
}, },
init () { init () {
var center = new maps.LatLng(this.center.latitude, this.center.longitude) var center = new maps.LatLng(this.center.latitude, this.center.longitude)
var map = this.map = new maps.Map(this.$el, { var map = this.map = new maps.Map(this.$refs.map, {
center, center,
zoom: Number(this.scale), zoom: Number(this.scale),
scrollwheel: false, scrollwheel: false,
...@@ -963,6 +972,9 @@ export default { ...@@ -963,6 +972,9 @@ export default {
<style> <style>
uni-map { uni-map {
position: relative;
width: 300px;
height: 150px;
display: block; display: block;
} }
</style> </style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册