使用svg.js,如何从自定义事件访问元素?
myCircle.on('someEvent', function(event) {
var circleX = event.x(); // event.x is not a function
circleX = event.target.x() // event.x is not a function
circleX = event.target.x() // event.target.x is not a function
circleX = this.x() // this is
我从那里得到了一个错误:
/root/diag/node_modules/ws/lib/WebSocket.js:422
event.target = target;
^
TypeError: Cannot assign to read only property 'target' of reserved fields (2, 3) must be empty
at WebSocket.onError (/root/diag/node_modules/ws/lib/WebSocket.js:422:18)
at WebS
一般说来,如果我没记错的话,我至少已经用过十几次了,但出于某种离奇的理由,它从今天早上起就不起作用了……有人有线索吗?
HTML:
<button id="testID" onclick="foo()">
test me
</button>
<button id="testID2" onclick="foo(this)">
test me 2
</button>
JS:
function foo(event){
alert(event.target.id);
}
我正在用Vue.js开发一个文件选择器。我想显示选定的文件预览。我使用 来实现这一点。我用readAsDataURL对象的FileReader方法读取用户选择的文件作为数据urls。
但是,我收到一条错误消息,表示reader.onload不是一个类似于:
Uncaught TypeError: reader.onload is not a function
at VueComponent.handleFileChanges
在前面提到的FileReader未定义错误之后,可能是读取器没有定义。
我试图这样做的方法如下:
handleFileChanges (e) {
var