mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-02-01 15:23:03 +00:00
optimise model.model method
This commit is contained in:
parent
418779604e
commit
ad2484212a
@ -81,7 +81,7 @@ export default class extends think.base {
|
||||
* @return {Object} []
|
||||
*/
|
||||
model(name, options, module){
|
||||
if(think.isString(options)){
|
||||
if(think.isString(options) && think.module.indexOf(options) > -1){
|
||||
module = options;
|
||||
options = {};
|
||||
}
|
||||
@ -90,6 +90,9 @@ export default class extends think.base {
|
||||
let seps = filename.split(think.sep).reverse();
|
||||
module = seps[2];
|
||||
}
|
||||
if(think.isString(options)){
|
||||
options = {type: options};
|
||||
}
|
||||
options = think.extend({}, this.config, options);
|
||||
return think.model(name, options, module);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user