mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-01-25 14:42:47 +00:00
add render method for controller, alias of display
This commit is contained in:
parent
eb81d7e78e
commit
fef8765325
@ -234,6 +234,16 @@ export default class extends think.http.base {
|
||||
this._baseAssign();
|
||||
return this.view().display(templateFile, charset, contentType);
|
||||
}
|
||||
/**
|
||||
* alias of display
|
||||
* @param {String} templateFile [template filepath]
|
||||
* @param {String} charset [content encoding]
|
||||
* @param {String} contentType [content type]
|
||||
* @return {Promise} []
|
||||
*/
|
||||
render(templateFile, charset, contentType){
|
||||
return this.display(templateFile, charset, contentType);
|
||||
}
|
||||
/**
|
||||
* output with jsonp
|
||||
* @param {Object} data [output data]
|
||||
|
||||
@ -423,6 +423,17 @@ describe('controller/base.js', function(){
|
||||
done();
|
||||
})
|
||||
})
|
||||
it('render', function(done){
|
||||
muk(think, 'log', function(){})
|
||||
getInstance({
|
||||
}).then(function(instance){
|
||||
return instance.render(__filename)
|
||||
}).catch(function(err){
|
||||
assert.equal(think.isPrevent(err), true);
|
||||
muk.restore();
|
||||
done();
|
||||
})
|
||||
})
|
||||
it('download', function(done){
|
||||
getInstance({
|
||||
header: function(type, value){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user