|
本帖最后由 ovarbi 于 2017-2-15 23:56 编辑
我参考http://bbs.wex5.com/forum.php?mo ... 76317&extra=&page=1来做了一个传参,我用的是netease的例子,我在里面加了一个windowDialog,在将要打开的子窗口加了windowReciever,都按规定写的:
- Model.prototype.loginIsmBtn = function(event) {
- var phoneInput = this.comp("nameInput").val();
- var passwordInput = this.comp("passwordInput").val();
- var reg = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
- if (!reg.test(phoneInput)) {
- return;
- }
- ;
- var userData = this.comp("baasData1");
- userData.clear();
- userData.filters.setVar("userPhone", phoneInput);
- userData.filters.setVar("password", passwordInput);
- userData.refreshData();
- if (userData.count() > 0) {
- justep.Util.hint("登录成功");
- justep.Shell.userType.set("ISM");
- justep.Shell.userName.set(phoneInput);
- localStorage.removeItem("userUUID");
- var user = {};
- user.userid = phoneInput;
- user.accountType = "ISM";
- user.name = phoneInput || "NONAME";
- localStorage.setItem("userUUID", JSON.stringify(user));
- this.comp("windowDialog1").open({
- data : phoneInput
- });
- setTimeout(function() {
- justep.Shell.closePage();
- }, 3000);
- } else {
- justep.Util.hint("用户或密码有误!", {
- "type" : "danger"
- });
- }
- };
复制代码 我加的代码就是其中的几行:
- this.comp("windowDialog1").open({
- data : phoneInput
- });
复制代码 在子窗口,我加入代码:
- Model.prototype.windowReceiver1Receive = function(event) {
- // this.userID = event.data;
- var userData = this.comp("baasData1");
- userData.clear();
- userData.filters.setVar("userPhone", event.data.toString());
- userData.refreshData();
- };
复制代码 我的想法就是,登录后传参手机号码给子窗口,子窗口用这个做筛选数据。action做了:
执行可以正常打开子窗口,但是数据出不来,出错:
这是啥错误?控制台没有返回任何错误信息,我个人的看法是,数据表没有任何行,因此不能用clear?
|
|