没有错误,但我无法触发我的功能。试图将我的exec_request函数放在switch语句的上方或下方,但仍然没有运气。
exec_request = (url) => {
alert('test') // not execute here?
}
switch(list_type) {
case 'temp': {
const url = `/shops/spaces/${temp}`;
exec_request(url)
break;
}
default: {
const url = `/shops/${shop_id}/spaces`;
exec_request(url)
}
}
const list_type = '';//'temp';
const temp = "tmp";
const shop_id = "123";
const exec_request = (url) => {
alert(url) // not execute here?
}
switch(list_type) {
case 'temp': {
const url = `/shops/spaces/${temp}`;
exec_request(url)
break;
}
default: {
const url = `/shops/${shop_id}/spaces`;
exec_request(url)
}
}