feat: 动态加载js模块
parent
3dce7f2635
commit
158ab8a311
@ -1,13 +1,29 @@
|
||||
const init = (params) => {
|
||||
console.log('moduleA init');
|
||||
return {
|
||||
name: 'ModuleA',
|
||||
functionName: params.type,
|
||||
otherParams: {
|
||||
id: `xxxx${params.type}`,
|
||||
age: `xxxx${params.type}`,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const getData = (params) => {
|
||||
console.log('moduleA getData');
|
||||
return {
|
||||
name: 'ModuleA',
|
||||
functionName: params.type,
|
||||
otherParams: {
|
||||
id: `xxxx${params.type}`,
|
||||
age: `xxxx${params.type}`,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default function (params) {
|
||||
console.log('moduleA');
|
||||
console.log(params);
|
||||
// console.log('moduleA');
|
||||
// console.log(params);
|
||||
return eval(params.type + '(params)');
|
||||
}
|
||||
|
||||
@ -1,13 +1,29 @@
|
||||
const init = (params) => {
|
||||
console.log('moduleB init');
|
||||
return {
|
||||
name: 'moduleB',
|
||||
functionName: params.type,
|
||||
otherParams: {
|
||||
id: `xxxx${params.type}`,
|
||||
age: `xxxx${params.type}`,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const getData = (params) => {
|
||||
console.log('moduleB getData');
|
||||
return {
|
||||
name: 'moduleB',
|
||||
functionName: params.type,
|
||||
otherParams: {
|
||||
id: `xxxx${params.type}`,
|
||||
age: `xxxx${params.type}`,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default function (params) {
|
||||
console.log('moduleB');
|
||||
console.log(params);
|
||||
// console.log('moduleB');
|
||||
// console.log(params);
|
||||
return eval(params.type + '(params)');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue