// 浏览器显示地址
var urlPath = window.document.location.href
// 文件在服务器相对地址
var docPath = window.document.location.pathname
// 获取详细完整IP地址
var index = urlPath.indexOf(docPath)
var serverPath = urlPath.substring(0, index)
// 截取ip地址
var result1 = serverPath.substring(serverPath.indexOf(':') + 1)
var result2 = result1.substring(0, result1.indexOf(':'))
this.websock = new WebSocket(process.env.VUE_APP_API_WEBSOCKET_BASE_URL)
网友评论