var vm = new Vue({
el:"#app",
data:{
user:{
"username":"",
"passwoed":"",
"age":"",
"hobby":"",
"ip":""
}
},
mounted(){
this.ready()
},
methods:{
ready:function(){
//获取本地IP地址
//js 引入 <!-- 获取本机ip -->
//<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script> // 在根html下引入 或者本页面 引入
var cip = returnCitySN["cip"];
//给vuedata对象里的字段赋值
this.user.ip = cip
}
}
})
12-20
2021
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-07
1353
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-01