zoukankan      html  css  js  c++  java
  • vue获取客户端ip地址

    公司需求:vue中获取客户端IP地址

    方法1:从网上找了一个,如下链接,根本不行,获取不了。

    https://www.cnblogs.com/cwl1025/p/14248306.html

    方法2:可行,链接如下:

    https://www.cnblogs.com/cwl1025/p/14248306.html

    在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))
  • 相关阅读:
    HDU 4005 The war
    #undef
    [转载] #define new DEBUG_NEW
    [转载]常用正则表达式
    [百科]
    [转载]
    [转载]
    [转载]
    [百科]
    [转载]VC6中的文件后缀
  • 原文地址:https://www.cnblogs.com/beimingbingpo/p/15791303.html
Copyright © 2011-2022 走看看