-
## DESC
例如 A表与B表是HAS_MANY的关系。设置了B是A的一对多关联模型。
在查询A时,希望可以获得对应的B表项目的总数。
我翻阅了thinkjs的文档,没有发现这个API
如果在A表中添加B表的总数的话,是不符合范式的...所以想来问一下...
## ENV
Platform:
Node.js Version:
ThinkJS Version…
-
## DESC
```js
let Template = think.adapter('template', 'dot'); //加载名为 dot 的 Template Adapter
let instance = new Template(...args); //实例化 Adapter
```
如何在adapter实例化后,通过mqtt监听,得到data, 如何将data传递…
-
db.js的配置写成这样:
```js
export default {
type: 'postgresql',
adapter: {
postgresql: {
user: 'root',
host: '127.0.0.1',
database: 'my_db',
…
-
## desc
mongo在使用聚合查询后,不能使用原有的page方法进行分页处理,这样如何对聚合查询后的数据进行分页处理呢?
`model.aggregate(options).page(pageNum, pageSize).countSelect()`
## ENV
Platform:ubuntu
Node.js Version:8
ThinkJS Version:…
-
## DESC
1, 我访问地址是 http://127.0.0.1:1888/user/login/index
2, `src/user/controller/login.js` 代码如下:
```
const Base = require('./base.js');
module.exports = class extends Base {
async index…
-
## DESC
要是先下载功能,文件名为中文。
```javascript
this.download(data[0].path, data[0].headers['content-type'], "af-api文档.md");
```
```
[Error] TypeError: The header content contains invalid characters
`…
-
## DESC
3.0 `model.page(this.get('page'),20)` 方法,page()的第一个参数,没有默认第一页。
`model.page(this.get('page')||1,20)` 要这样用才会正确显示。
## ENV
Platform:
Node.js Version:
ThinkJS Version:3.0
-
## DESC
關於 controller.download
\thinkjs\src\controller\base.js 344 line
下載中文檔名會有問題
我程式參考 https://my.oschina.net/jsan/blog/180333
改成 如下是正常的 , 口否參考一下改官網程式
```js
var userAgent = (this.http.…
-
I want to render remote template in my project, I tried controller.fetch like this:
`
let tpl = await this.fetch("http://10.100.100.xx:xxxx/aa/bb/index.html");
`
but I got this error
> …
-
## DESC
多模块项目,扩展了ctx对象,控制器里访问的时候报错如下:
> TypeError: _this.ctx.tests is not a function
src/extend/context.js
`
module.exports = {
tests(str) {
return str + '========';
}
}
`
XX…