如何获取服务器的IP地址
export default {
data() {
return {
serverIp: ''
}
},
created() {
this.getServerIp()
},
methods: {
getServerIp() {
axios.get('https://api.ipify.org?format=json')
.then(response => {
this.serverIp = response.data.ip
})
.catch(error => {
console.log(error)
})
}
}
}登录后复制
您可能感兴趣的文章: