如何从函数返回字符串列表?

时间:2019-05-10 05:06:26

标签: javascript

如何通过函数传递字符串列表?我正在呼叫端点。目前,我将模拟API并返回字符串列表。我被困在这里。有人可以帮我吗?

mock.onGet('/patients/100/advanced-graphings').reply(200, {
  advancedGraphing: '[ "Graph 1" , "Graph 2" , "Graph 3" , "Graph 4" , "Graph 5" , "Graph 6" ]'
});

1 个答案:

答案 0 :(得分:0)

我认为您应该从advancedGraphing对象值中删除单引号。

mock.onGet('/patients/100/advanced-graphings').reply(200, {
  advancedGraphing: [ "Graph 1" , "Graph 2" , "Graph 3" , "Graph 4" , "Graph 5" , "Graph 6" ]
});