callout什么意思?(微信小程序开发之callout自定义气泡的实现)

callout什么意思?(微信小程序开发之callout自定义气泡的实现) 2次播放   00:00

项目经理微信二维码

扫码咨询/索取案例

专注社交新零售系统开发,助力传统企业转型移动互联网!

联系电话:13022089681

callout什么意思?(微信小程序开发之callout自定义气泡的实现)

001

002

003

004

005

006

007

008

009

010

011

012

013

014

015

016

017

018

019

020

021

022

023

024

025

026

027

028

029

030

031

032

033

034

035

036

037

038

039

040

041

042

043

044

045

046

047

048

049

050

051

052

053

054

055

056

057

058

059

060

061

062

063

064

065

066

067

068

069

070

071

072

073

074

075

076

077

078

079

080

081

082

083

084

085

086

087

088

089

090

091

092

093

094

095

096

097

098

099

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

varapp=getApp();

Page({

data:{

url:'',[color=#0800][backcolor=rgb(255,255,254)][font=Consolas]//测试的时候把下面listData换成身边的点就行[/font][/backcolor][/color]

listData:[{

"id":1,

"placeName":"测试地址1",

"placeImageUrl":"",

"placeOpenTime":1506200400,

"placeCloseTime":1506265200,

"placeAddress":"测试地址1啊",

"placeLongitude":"114.08190678985596",

"placeLatitude":"22.544808209639864"

},{

"id":2,

"placeName":"测试地址2",

"placeImageUrl":"",

"placeOpenTime":1506200400,

"placeCloseTime":1506265200,

"placeAddress":"测试地址2啊",

"placeLongitude":"114.0938372555542",

"placeLatitude":"22.53953655390022"

},{

"id":3,

"placeName":"测试地址3",

"placeImageUrl":"",

"placeOpenTime":1506243600,

"placeCloseTime":1506265200,

"placeAddress":"测试地址3啊",

"placeLongitude":"114.05454",

"placeLatitude":"22.52291"

}],

scale:'15',

Height:'0',

controls:'40',

latitude:'',

longitude:'',

markers:[],

},

onReady:function(e){

//使用wx.createMapContext获取map上下文

this.mapCtx=wx.createMapContext('myMap')

},

onLoad:function(){

varthat=this;

that.setData({

url:app.globalData.url

})

//vardata=JSON.stringify({

//page:1,

//pageSize:10,

//request:{

//placeLongitude:app.globalData.longitude,

//placeLatitude:app.globalData.latitude,

//userId:app.globalData.userId

//}

//})

wx.getLocation({

type:'gcj02',//返回可以用于wx.openLocation的经纬度

success:(res)=>{

console.log(res);

that.setData({

markers:that.getSchoolMarkers(),

scale:12,

longitude:res.longitude,

latitude:res.latitude

})

}

});

wx.getSystemInfo({

success:function(res){

//设置map高度,根据当前设备宽高满屏显示

that.setData({

view:{

Height:res.windowHeight</div>

}

})

}

})

},

bindcallouttap:function(e){

console.log("头上文字被点击",e)

},

markertap:function(e){

console.log("定位的点被点击",e)

},

controltap:function(e){

console.log("111")

this.moveToLocation()

},

getSchoolMarkers(){

varmarket=[];

for(letitemofthis.data.listData){

letmarker1=this.createMarker(item);

market.push(marker1)

}

console.log("market===========",market)

returnmarket;

},

moveToLocation:function(){

this.mapCtx.moveToLocation()

},

strSub:function(a){

varstr=a.split(".")[1];

str=str.substring(0,str.length-1)

returna.split(".")[0]+'.'+str;

},

createMarker(point){

letlatitude=this.strSub(point.placeLatitude);

letlongitude=point.placeLongitude;

letmarker={

iconPath:"",

id:point.id||0,

name:point.placeName||'',

title:point.placeName||'',

latitude:latitude,

longitude:longitude,

label:{

x:-24,

y:-26,

content:point.placeName

},

width:50,

height:50,

callout:{

content:point.placeName||'',

fontSize:14,

bgColor:"#FFF",

borderWidth:1,

borderColor:"#CCC",

padding:4,

display:"ALWAYS",

textAlign:"center"

}

};

returnmarker;

}

})

大家都在看

波浪线

发表评论

波浪线

您必须 登录 才能发表评论!

评论 (0)

波浪线
还没有评论,发表第一个评论吧
您好,我是您的专属产品顾问
扫码添加我的微信,免费体验系统
(工作日09:00 - 18:00)
业务咨询
系统演示
行业方案
客户案例

请按ESC键关闭