Skip to content

模板 : element : 处理事件

eprom2006 edited this page Feb 9, 2020 · 1 revision

事件绑定

click : 绑定click事件处理函数

{
    e:"a",
    t:"click sample",
    click:function(p){
        alert("hi!");
    }
}

传入参数结构

{
    sender:{事件引发元素},
    org_data:{原始数据},
    new_data:{新数据}
}

event : 添加事件侦听器

    {
        e:"div",
        t:"event sample",
        event:{
            click:function(p){
                alert("click");
            },
            dblclick:function(p){
                alert("dblclick");
            }
        }
    }

event的成员名作为侦听的事件名,值函数作为event handler。

handler的传入参数结构如下:

    {
        sender:{事件源},
        event:{事件},
        type:{事件类型},
        org_data:{原始数据},
        new_data:{新数据}
    }
Clone this wiki locally