可以在自定义元素上定义自定义函数吗?
类似的东西:
var proto = Object.create(HTMLElement.prototype);
proto.customMethod = function () { ... };
document.registerElement('custom-el', {
prototype: proto
});
在元素上调用方法:
var istance = document.createElement('custom-el');
instance.customMethod();
答案 0 :(得分:3)
是的,当然。
您的示例可以在下面的代码段中看到:
numpy.sum(a, axis=None, dtype=None, out=None, keepdims=False)[source]
Sum of array elements over a given axis.
Parameters:
...
keepdims : bool, optional
If this is set to True, the axes which are reduced are left in the result as
dimensions with size one. With this option, the result will broadcast
correctly against the input array.
...