🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# map生成位置地图 ## map生成位置地图 与内置的地图位置选取插件生成百度地图、高德地图。 > 2.1.220504版本起 ## 示例 默认模板示例,$Info 为内容 ``` <pre class="calibre16">``` <span class="token1">{</span>hkcms<span class="token1">:</span>map htmlid<span class="token">=</span><span class="token4">"dituContent"</span> attr<span class="token">=</span><span class="token4">"class='diyclass' style='width:1800px;height:400px'"</span> title<span class="token">=</span><span class="token4">"$Info['company']"</span> address<span class="token">=</span><span class="token4">"$Info['address']"</span> scale<span class="token">=</span><span class="token4">"19"</span> point<span class="token">=</span><span class="token4">"$Info['point']"</span><span class="token1">}</span> ``` ``` ## 参数说明 参数名称可选值默认值是否必填说明htmlid-dituContent-div标签 id属性,你可以使用该ID写样式attr---div标签属性,注意attr里面使用单引号title---地图面板标题address---地图面板地址scale-19-放大级别point---经纬度信息,格式为json,例如:{"lng":116.404,"lat":39.915}**完整流程:** 1. 增加模型字段,**附加属性**增加如下配置,data-point 用于选择位置后填充到哪个输入框,data-address 用于选择位置后返回的详细地址填充到哪个输入框 `data-toggle="address",data-point="frm-point",data-address="frm-address"` ![](https://img.kancloud.cn/e5/b5/e5b534c8e642c82a386798647ec64b67_1050x853.png) 2. 选择位置 ![](https://img.kancloud.cn/d0/63/d063a21a00a178657ef53b17ad304a9c_1479x151.png) 3. 模板调用: ``` <pre class="calibre16">``` <span class="token1">{</span>hkcms<span class="token1">:</span>map htmlid<span class="token">=</span><span class="token4">"dituContent"</span> title<span class="token">=</span><span class="token4">"$Info['company']"</span> address<span class="token">=</span><span class="token4">"$Info['address']"</span> scale<span class="token">=</span><span class="token4">"19"</span> point<span class="token">=</span><span class="token4">"$Info['point']"</span><span class="token1">}</span> ``` ``` ![](https://img.kancloud.cn/90/48/90483c69537c6cffce3d5f765a65c3ba_944x424.png)