有一个小小的优化,可以在组件文件夹里设置一个通用出口,比如在 statistic 文件夹下增加 index.js: import Overview from './overview' import AgentStatistic from './agentStatistic' // ... export { Overview, AgentStatistic, // ... } 在这个文件中使用: import { Overview, AgentStatistic, // ... } from './statistic' 或者 import * as CUSTOM_NAME from './statistic',使用时,用 CUSTOM_NAME.overview 这种方式
有一个小小的优化,可以在组件文件夹里设置一个通用出口,比如在
statistic
文件夹下增加index.js
:在这个文件中使用: