(vue)前端获取ip方法


data(){return:{ipAddress: "",}},mounted() { this.getIPAddress(); },//获取ipgetIPAddress() {const url = "http://api.ipify.org?format=json";this.axios.get(url).then((response) => {this.ipAddress = response.data.ip;console.log(this.ipAddress);});},

解决参考:https://www.fke6.com/html/78898.html