-1
エラーは発生していませんが、関数がトリガされません。私のexec_request関数をswitch文の上または下に置くことを試みましたが、まだ運がありません。 es6 arrow関数はswitch文では機能しません
エラーは発生していませんが、関数がトリガされません。私のexec_request関数をswitch文の上または下に置くことを試みましたが、まだ運がありません。 es6 arrow関数はswitch文では機能しません
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)
}
}
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)
}
}
はおそらく
this.exec_request(url)
を呼び出す必要があります。
これをとタグ付けしたので、exec_request
はグローバルな機能ではありません。
再生できません。具体的な例を作成してください。 – str
おそらく 'this.exec_request(url)'?あなたはこれを[tag:reactjs]とタグ付けしたので、 –
@Danあなたはコメントも答えです。 – Ved