-1
這是對象的樣子:如何訪問下列JavaScript對象的「ondrag」方法?
這就是我如何訪問它: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組件元素? – nils
你嘗試過'this.el.ondrag'嗎? – mrahhal
...因爲el是財產,而不是函數。你分配peroperties,你調用函數。 'thie.el.ondrag = function(){/ * codes here * /};'可能是要走的路。 – 2016-03-15 15:40:34