- 当前 Bug 的表现(可附上截图)
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
我在app.js 里面给Object原型添加了一个方法
onLaunch: function () { Object.prototype.foo = function (){ console.log( "xxxx" ) } } |
然后新建了一个自定义组件,开发工具就一直报错,去掉上面这段代码就正常了,这是为什么??
报错信息:
VM2026:1 thirdScriptError sdk uncaught third Error Cannot read property 'name' of undefined TypeError: Cannot read property 'name' of undefined at j (http: //127 .0.0.1:60556 /appservice/__dev__/WAService .js:1:844772) at G (http: //127 .0.0.1:60556 /appservice/__dev__/WAService .js:1:849707) at Object.t (http: //127 .0.0.1:60556 /appservice/__dev__/WAService .js:1:851485) at yt (http: //127 .0.0.1:60556 /appservice/__dev__/WAService .js:1:950556) at Bt (http: //127 .0.0.1:60556 /appservice/__dev__/WAService .js:1:964920) at http: //127 .0.0.1:60556 /appservice/components/coin/index .js:4:1 at require (http: //127 .0.0.1:60556 /appservice/__dev__/WAService .js:1:971778) at <anonymous>:17:7 at HTMLScriptElement.scriptLoaded (http: //127 .0.0.1:60556 /appservice/appservice ?t=1551863441632:1133:21) at HTMLScriptElement.script.onload (http: //127 .0.0.1:60556 /appservice/appservice ?t=1551863441632:1145:20) |
目前暂不支持此功能。
是不支持在Object.prototype上添加方法么?其他原型呢,比如Array.prototype?