[英]how to access global variables from parse modules?
I have the main.js file in the parse cloud, where I import an util module 我在解析云中有main.js文件,在其中导入了util模块
var util = require('cloud/util.js');
Now, I have another module, called user 现在,我有另一个模块,称为用户
var user = require('cloud/user.js');
The problem is that if I want to use the util var inside the user, it will say: 问题是,如果我想在用户内部使用util var,它将说:
Failed with: ReferenceError: util is not defined
显然,require更像是一个导入,因此,如果您想在user.js文件中使用util,只需添加一个新的
var util = require('cloud/util.js');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.