获取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 2020-04-13 17:50  uniapp  阅读(3448)  评论(0编辑  收藏  举报