共 5 篇文章 |
|
TemplateTemplate。支持模版引擎类型 模版引擎配置 使用模版引擎 扩展模版引擎类型 使用第三方模版 Adapter.Template Adapter 用来实现支持多种类型的模版引擎,如:ejs,swig 等。base ejs ejs 模版引擎 jade jade 模板引擎 swig 一种支持模版继承的模版引擎 nunjucks 一种类似 jinja2 的模版引擎,功能非常强大 模版引擎配置。export defaul... 阅27 转0 评0 公众公开 16-06-28 17:39 |
WebSocketWebSocket.io 对象 设置 path 设置 adapter socket.io client 校验用户登录 聊天代码示例 SockJS.export default { on: false, //是否开启 WebSocket type: "socket.io", //使用的 WebSocket 库类型,默认为 socket.io allow_origin: "", //允许的 origin adp: undefined, // socket 存储的 adapter,socket.io ... 阅76 转0 评0 公众公开 16-06-28 17:38 |
Session.支持的 Session 类型 Session 配置 Session 读写 扩展 Session 使用第三方 Session Adapter.export default class extends think.controller.base { * indexAction(){ //获取session let value = yield this.session("userInfo"); }} 设置 Session.export default class extends think.controller.base { * indexAction(){ /... 阅54 转0 评0 公众公开 16-06-28 17:38 |
Adapter.创建一个名为 dot 的 Template Adapter,创建的文件路径为 src/common/adapter/template/dot.js。//加载名为 dot 的 Template Adapterlet instance = new Template(...args); //实例化 Adapter 使用第三方 Adapter.加载 Adapter 时,系统会自动从 src/common/adapter 目录和系统目录查找对应的 Adapter,如果引入第三方的 Adapter,需... 阅30 转0 评0 公众公开 16-06-28 17:37 |
缓存类型 缓存配置 使用缓存 扩展缓存 使用第三方缓存 Adapter.export default { type: "file", //缓存类型 timeout: 6 * 3600, //失效时间,单位:秒 adapter: { //不同 adapter 下的配置 file: { path: think.RUNTIME_PATH + "/cache", //缓存文件的根目录 path_depth: 2, //缓存文件生成子目录的深度 file_ext: ".... 阅34 转0 评0 公众公开 16-06-28 17:31 |