js 导出模块

最后更新于:2022-04-02 03:36:56

[TOC] ## js export 导出模块 方式一 ``` //判断登陆设备 //#ifdef APP-PLUS var device_type = 'mobile' //#endif //#ifdef MP var device_type = 'wxapp' //#endif var host = "https://hrai.online"; var socketUrl = "wss://hrai.online:39005/"; module.exports = { socketUrl:socketUrl, HOST: host, API_ROOT: host + '/api/', DeviceType: device_type, post(options) { this.request(options); }, delete(options) { options.method = 'DELETE'; this.request(options); }, }; ``` 方式二: ``` function demo(){ echo "hello world" } export { demo } ```
';