代码
const map = new BMap.Map('map');
var point = new BMap.Point(116.307852, 40.057031);
map.centerAndZoom(point, 11);

var content =
  '<p style="width:280px;margin:0;line-height:20px;">地址:北京市海淀区上地十街10号<br/>电话:(010)59928888</p>';
var searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, {
  title: '百度大厦', // 标题
  width: 290, // 宽度
  height: 40, // 高度
  panel: 'panel', // 检索结果面板
  enableAutoPan: true, // 自动平移
  enableSendToPhone: true, // 是否显示发送到手机按钮
  searchTypes: [
    BMAPLIB_TAB_SEARCH, // 周边检索
    BMAPLIB_TAB_TO_HERE, // 到这里去
    BMAPLIB_TAB_FROM_HERE, // 从这里出发
  ],
});

var marker = new BMap.Marker(point);
map.addOverlay(marker);
searchInfoWindow.open(marker);

BMapLib.SearchInfoWindow 检索信息窗口。如果你使用JSAPI 4.0,建议用 BMap.InfoWindow

预览