vue 中获取客户端所在ip及ip所属的地理位置

在index.html中

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

在想获取ip的页面中

      var Ip=returnCitySN['cip']
      var cityname=returnCitySN['cname']
      localStorage.setItem('Ip', Ip)
      console.log(localStorage.getItem('Ip', Ip))
      localStorage.setItem('cityname', cityname)
      console.log(localStorage.getItem('cityname', cityname))