【发布时间】:2016-03-15 15:29:39
【问题描述】:
这是对象的样子:
这就是我访问它的方式:console.log(this)(this 输出 Directive 对象)。
如何调用这个对象的ondrag事件?
我试过了:
this.el('ondrag', function(event) {
console.log(event)
})
但我得到了:
caught TypeError: this.el is not a function
访问ondrag 事件的正确方法是什么?
【问题讨论】:
-
您是否尝试将
drag事件处理程序绑定到 vue 组件元素? -
你试过
this.el.ondrag吗? -
... 因为 el 是属性,而不是函数。你分配属性,你调用函数。
thie.el.ondrag = function(){ /* codes here */ };可能是要走的路。
标签: javascript vue.js