美文网首页
vue 获取本地IP地址

vue 获取本地IP地址

作者: 带熊二来看简书 | 来源:发表于2020-02-21 17:11 被阅读0次

index.html中引入:

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

vue文件中:

mounted(){
  this.ready();
},
  methods:{
    ready(){
     var cip = returnCitySN["cip"];
     console.log(cip);//cip就是本机ip地址
 },

相关文章

网友评论

      本文标题:vue 获取本地IP地址

      本文链接:https://www.haomeiwen.com/subject/ekthqhtx.html