豆子5945
豆子5945
  • 发布:2017-07-27 17:17
  • 更新:2017-07-27 17:17
  • 阅读:893

传值之后值赋值问题

分类:MUI

我有个子页面收到父页面传过来的值
子页面的代码是

        var localData = 'local';  
        window.addEventListener('dataParam',function(event){  
                console.log('currentDataType1='+localData);    //1  
                localData = event.detail.currentDataType;  
                console.log('currentDataType2='+localData);        //2  

        });  

        mui.plusReady(function (){  
             document.getElementById('dateSelect').addEventListener('tap',function (){  
                    console.log(localData);                               //3  
                });  
        });  

运行结果是1:local 2:hour 3:local
为什么最后dateSelect的点击事件中的localData值变为原来的local了而不是hour

2017-07-27 17:17 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复