Javascript 如何导出动态?
我有目录Javascript 如何导出动态?,javascript,reactjs,Javascript,Reactjs,我有目录 /main index.js other other1 other2 /data index.js type1.js type2.js 在top index.js中 export * from './other'; export * from './other1'; export * from './other2'; export * from './data'; 在type1.js中 export const Q => <d
/main
index.js
other
other1
other2
/data
index.js
type1.js
type2.js
在top index.js中
export * from './other';
export * from './other1';
export * from './other2';
export * from './data';
在type1.js中
export const Q => <div>hi</div>
export const Q => <div>how are u?</div>
cont data = () => {
if (condition){
return require('./type1.js');
}else {
return require('./type2.js');
}
}
export default data;