Commit 62293451 authored by yzl's avatar yzl

- 修改config.json路径问题

parent ded24a49
...@@ -156,9 +156,18 @@ ...@@ -156,9 +156,18 @@
useEffect(() => { useEffect(() => {
const getIp = () => { const getIp = () => {
const url = window.location.pathname;
let currentUrl = '';
if(url.indexOf('index.html') !== -1){
currentUrl = url.substring(0, url.indexOf('index.html'));
} else {
currentUrl = url;
}
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: './config.json', url: window.location.origin + currentUrl + '/config.json',
success: function(data) { success: function(data) {
setIp(data.ip); setIp(data.ip);
......
...@@ -203,9 +203,18 @@ ...@@ -203,9 +203,18 @@
} }
const getIp = () => { const getIp = () => {
const url = window.location.pathname;
let currentUrl = '';
if(url.indexOf('index.html') !== -1){
currentUrl = url.substring(0, url.indexOf('index.html'));
} else {
currentUrl = url;
}
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: './config.json', url: window.location.origin + currentUrl + '/config.json',
success: function(data) { success: function(data) {
setIp(data.ip); setIp(data.ip);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment