亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

js中,這種寫法的傳參怎么解釋,涉及什么知識點?

js中,這種寫法的傳參怎么解釋,涉及什么知識點?

慕田峪9158850 2018-12-19 14:15:35
在看ztree樹的demo中,看到這樣的傳參方式$("#addLeaf").bind("click", {isParent:false}, add); var newCount = 1;    function add(e) {        var zTree = $.fn.zTree.getZTreeObj("treeDemo"),        isParent = e.data.isParent,        nodes = zTree.getSelectedNodes(),        treeNode = nodes[0];        console.log(e.data.vip);        if (treeNode) {            treeNode = zTree.addNodes(treeNode, {id:(100 + newCount), pId:treeNode.id, isParent:isParent, name:"new node" + (newCount++)});        } else {            treeNode = zTree.addNodes(null, {id:(100 + newCount), pId:0, isParent:isParent, name:"new node" + (newCount++)});        }        if (treeNode) {            zTree.editName(treeNode[0]);        } else {            alert("葉子節點被鎖定,無法增加子節點");        }    };        在第一行代碼中,給add函數傳入了isParent:false ,而在add行數中,使用e.data.isParent來獲取傳過來的參數,請問這種寫法涉及的知識點事什么?以前沒有看到過這樣的傳參方式。
查看完整描述

1 回答

?
梵蒂岡之花

TA貢獻1900條經驗 獲得超5個贊

這種情況翻翻文檔就知道了。

.bind( eventType [, eventData ], handler )

第二個參數是eventData
說明如下:

eventData
Type: Anything
An object containing data that will be passed to the event handler.

文檔上應該說的很清楚了。


查看完整回答
反對 回復 2019-01-25
  • 1 回答
  • 0 關注
  • 435 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號