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地址
},
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
网友评论