如下,我很想在这个对象中的函数访问该对象的字段,有方法吗?
Confirm.defaultProps={
title:"提示",
visible:true,
cancel:function(){
console.log(title)
}
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
改成
this.tile即可。注意调用时候要写成Confirm.defaultProps.cancel();不能写成var cancel = Confirm.defaultProps; cancel();这种用
this就可以访问到了console.log(this.cancel());