e.detail.el.innerText的el指什么

var list=document.querySelector('.mui-table-view.mui-table-view-radio');

list.addEventListener(function(e){

    console.log("当前选中的是:"+e.detail.el.innerText);

});


MMTTMM
浏览 1008回答 1
1回答

慕田峪7331174

如上图所示,e.detail.el值的是当前选中的li元素,此时是第一个li,li元素的innerText是"Item 1";代码如下所示:<ul class="mui-table-view mui-table-view-radio">&nbsp; &nbsp; <li class="mui-table-view-cell">&nbsp; &nbsp; &nbsp; &nbsp; <a class="mui-navigate-right">Item 1</a>&nbsp; &nbsp; </li>&nbsp; &nbsp; <li class="mui-table-view-cell mui-selected">&nbsp; &nbsp; &nbsp; &nbsp; <a class="mui-navigate-right">Item 2</a>&nbsp; &nbsp; </li>&nbsp; &nbsp; <li class="mui-table-view-cell">&nbsp; &nbsp; &nbsp; &nbsp; <a class="mui-navigate-right">Item 3</a>&nbsp; &nbsp; </li></ul>var list = document.querySelector('.mui-table-view.mui-table-view-radio');list.addEventListener('selected',function(e){&nbsp; &nbsp; console.log("当前选中的为:"+e.detail.el.innerText);});
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript