map組件默認在最上面,若要設置像ofo那樣的按鈕有兩個方法,一是用控件設置,控件就是controls屬性,
控件只能顯示圖片,不能顯示文字之類的。二是用cover-view組件,這個組件就是懸浮在一些組件上的,用於設置
在map上或者設置在視頻播放上等等,上面提到map標簽要用標簽對就是應對這種情況。將cover-view組件嵌套在
map組件內就可以了。cover-image組件可以嵌套在cover-view內。
<map id="myMap" show-location="true" style="width: 100%; height:{{height}}px; " longitude="{{x}}" latitude="{{y}}" scale="17" controls="{{controls}}" bindcontroltap="code" bindupdated="show"> <cover-view class='btn' bindtap='codeg'> <cover-image src='../img/掃碼.png' class='code'></cover-image> <cover-view class='text'>立即購買</cover-view> </cover-view> <cover-view class='ten' bindtap='gps'> <cover-image src='../img/定位.png' class='ten_l'></cover-image> </cover-view> </map>
注意:cover-view中只支持嵌套cover-view
、cover-image
,button