更新记录

1.0.1(2021-09-07)

初次发布。


平台兼容性

阿里云 腾讯云 支付宝云
× ×

云函数类插件通用教程

使用云函数类插件的前提是:使用HBuilderX 2.9+


EXPLAIN-UNICLOUD-MVC

框架交流QQ群:970799055

示例地址:https://tcb-e386czuna1dv2wib7e6bd-d064f3.service.tcloudbase.com/http/pages

使用方式

业务类继承 explain.mvc.controller,可以继承两个方法:view()返回视图 和 redirect()重定向

const explain = require("explain-unicloud");
explain.mvc = require("explain-unicloud-mvc");

const userModel = require("../models/user");

module.exports = class home extends explain.mvc.controller {

    index() {
        // 返回视图
        return this.view();
    }

    redirect() {
        // 重定向到index
        return this.redirect('/http/pages/index.html');
    }

    user() {
        let user = new userModel();
        user.name = "Sansnn";
        // 返回视图带模型
        return this.view(user);
    }

}

控制器

页面渲染

使用 JavaScript 模板引擎进行页面渲染,内部采用 lodash template 进行实现。

lodash template语法

参考:http://lodash.think2011.net/template

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问