【发布时间】:2014-09-17 21:30:01
【问题描述】:
情况:使用函数来声明你的类
如果你像 WinJs 那样使用和声明带有一些自定义(或框架函数)的类(检查他们的开源 git 目录),你肯定熟悉这种代码:
函数定义(构造函数,instanceMembers,staticMembers){}
函数派生(baseClass,构造函数,instanceMembers,staticMembers){}
define(function constructor(){
this.yourProperty = 1;
}, {
// Prototype object
somePrototypeFunction: function(){
// When you type "this." here, it will not show up "yourProperty" declared
// in the constructor, because you have not instanciated the class,
// intellisense does not know that everything is linked
}
}
这些“自定义”函数的常见问题
当您尝试从原型函数访问构造函数中声明的值时,Intellisense 不会显示它们。
这导致我找到了我在下面分享给你的解决方案,让它工作起来很痛苦,实际上我正要**再次**放弃这个问题,这确实令人失望,尤其是对于大团队项目。 我觉得很奇怪,网上没有很多关于这个的投诉,也许是配置问题?但是,我看到的所有 VSD 安装都有这个问题。
因此,如果您遇到相同的情况,我希望以下解决方案也能对您有所帮助。
【问题讨论】:
标签: javascript visual-studio object intellisense