|
楼主 |
发表于 2016-9-7 17:57:02
|
显示全部楼层
怎样获取父类的值
Model.prototype.regBtnClick = function(event){
console.log(this.comp('regData'))
var parentdata = this.getParent().comp("logindata");
var fphone = this.comp('regData').val('phone');
var password = $(this.getElementByXid('password')).val()
var repassword = $(this.getElementByXid('repassword')).val()
var code = $(this.getElementByXid('code')).val()
if(phone=''||password==''||repassword==''||code==''){
alert("请将信息填写完整!") }
else{
$.ajax({
url :"http://192.168.0.113/quiz/index.php/Admin/index/register",
type:"POST",
data: {user_phone:fphone,user_password:password,repassword:repassword},
async:false,
dataType:"json",
success : function(data) {
var options=[];
if(data.id!=0){
options.push({"id":data.username,"username":data.username});
parentdata.loadData(options);
console.log(parentdata.val('username'))
// justep.Shell.showPage("personal");
}else{
alert(data.username)
}
}
})
}
};
例如上面所示的 我想获取parentdata.val('username') 但是打印出来的是undefined 为什么错了 父类的取值是怎么取的?
|
|