随笔 - 27  文章 - 0  评论 - 5  阅读 - 33万

获取ip地址,并根据ip获取当前省份

<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>

 

//methods里面

// 获取省份
 ready:function(){
                             var that=this;
                                  //获取本地IP地址
                              var cname = returnCitySN["cname"];
                              //给vuedata对象里的字段赋值
                              console.log(cname);
                          },

//页面挂载时

mounted() {
                    setInterval(this.getTableHeight, 500);
                    this.ready();
                },

posted on   uniapp  阅读(3538)  评论(0编辑  收藏  举报
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示