前端学习笔记202309学习笔记第九十七天-typescript知识讲解4


const oInputText=document.querySelector('#inputText')
const oAddBtn=document.querySelector('#addBtn')
const oTodoList=document.querySelector('#todoList')
const eventMap=new Map([
    [oAddBtn,handleAddBtnClick],
    [oTodoList,handleListClick],
]
)

const init=()=>{
    bindEvent()
}
function bindEvent(){
   eventMap.forEach((handler,el)=>{
    el?.addEventListener("click",handler,false)
   })
}
function handleAddBtnClick(){

}
function handleListClick(){

}

posted @ 2023-09-29 21:15  前端导师歌谣  阅读(13)  评论(0)    收藏  举报  来源