ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] # 示例代码 ``` /** * 示例代码 * 可参照此代码进行复制进行扩展 * @author hongwei 2018-05-18 */ layui.define(['jquery','layer','form','laytpl','func','ajax'], function(exports){ 'use strict'; var $ = layui.$ ,layer = layui.layer ,form = layui.form ,laytpl = layui.laytpl ,func = layui.func ,ajax = layui.ajax //外部接口 , example = { config: {} //全局配置项 //设置全局项 ,set:function (options) { // } } //字符常量 , MOD_NAME = 'example' //构造器 ,Class = function(options){ var that = this; that.init(); //基本操作 }; //默认配置 Class.prototype.config = { debug : false //调试开关,true打开,false关闭 }; //初始基本操作 Class.prototype.init = function() { var that = this , options = that.config; //todo }; //渲染 example.render = function(options){ var inst = new Class(options); return inst; }; exports(MOD_NAME, example); }); ``` # 使用 ``` <script> layui.config({ base: GV.ROOT+'static/larry/lib/' }).extend({ login: 'agent/login' }).use(['form','layer','login','jqform','jqajax'],function () { let form = layui.form ,layer = layui.layer ,login = layui.login; login.render(); }); </script> ```