【发布时间】:2021-02-09 11:12:10
【问题描述】:
美国有 51 个州。 每个州都有很多城市。 我想获取每个州的城市列表。 所以我只是尝试如下。
使用过的库:
npm install country-state-city
npm install usa-states
import { UsaStates } from 'usa-states';
import csc from 'country-state-city';
const usStates = new UsaStates();
const states = usStates.states.map((state) => state.name);
const cities = csc.getCitiesOfCountry(states[0]);
但是变量cities没有结果。
【问题讨论】:
-
“美国有 51 个州” - 你甚至没有正确理解地缘政治的基本事实这一事实并不能让我对你的其余部分充满信心能力...
-
请不要粘贴可以用文字代替的图片。 meta.stackoverflow.com/questions/285551/…
-
But no results是什么意思?你不要console.log它,你没有报告任何错误。此外,您可以通过发布库文档来帮助您的助手(我们),我们(和您)可以在其中阅读其 API 文档。 -
csc来自哪里? -
@Dai Politics of USA != geopolitics.