获取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();
                },

原文地址:https://www.cnblogs.com/uniapp/p/12692848.html