我有个子页面收到父页面传过来的值
子页面的代码是
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
0 个回复