var MyPlugin = require('@ali/auto-router-plugin');
new MyPlugin({
basePath: path.resolve(process.cwd(),'./assets'), //前端目录的base路径
modelsPath: path.resolve(process.cwd(),'./assets/models'), // models目录的路径
scenesPath: path.resolve(process.cwd(),'./assets/scenes'), // scenes目录的路径
extensions: ['jsx', 'js'] // 识别文件类型
})
AutoRouter.js
module.exports = {
"./scenes/algorithm/add.jsx": require('./scenes/algorithm/add.jsx'),
"./scenes/algorithm/add_new.jsx": require('./scenes/algorithm/add_new.jsx'),
"./scenes/algorithm/list.jsx": require('./scenes/algorithm/list.jsx')
}
AutoModel.js
module.exports = {
"./models/alg_category.js": require('./models/alg_category.js'),
"./models/alg_define.js": require('./models/alg_define.js'),
"./models/alg_inst.js": require('./models/alg_inst.js')
}