1.在index.html中写
1 | <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=您的密钥"></script> |
2.在lib
里面封装一个getLocation.js
1 | let getCurrentCityName = function() { |
3.在你需要定位的文件里面写
1 | mounted(){ |
1 | <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=您的密钥"></script> |
lib
里面封装一个getLocation.js
1 | let getCurrentCityName = function() { |
1 | mounted(){ |