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))


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM