痛点形容:

援用内部js资源中的变量时,IDE正告变量未定义,并且在编写时无提醒,大大的影响开发体验、效率,增大bug率。上面为大家介绍二种解决方案。

解决方案

一、webstorm library性能,下载近程资源到本地

原理:

  • 把近程资源下载到webstorm中的lib本地空间
  • 设置lib的失效的范畴 (默认是global全局作用域)

应用办法

把光标挪动到资源的url上,并点击下载到本地后,提醒呈现了

webstorm左侧导航栏library呈现了下载的库

wxSdk.js代码内容

const wxSdk={    getUserInfo:function(cb){        return 11;    },    getUserId:function(){        return 22    },}window.wxSdk=wxSdk;

其余阐明:
class类也是能够有提醒的

point.js

class Point {    constructor(x, y) {        this.x = x;        this.y = y;    }    distance(a, b) {        const dx = a.x - b.x;        const dy = a.y - b.y;        return Math.hypot(dx, dy);    }    fn2(){        return 1;    }}window.Point=Point;

近程jquery文件测试,援用近程和援用下载到本地后的比照成果

不实用的场景,某些打包的内容

哪位大佬晓得解决方案,欢送留言。

uuid没有提醒
<script src="https://cdn.bootcdn.net/ajax/libs/uuid/8.3.2/uuid.min.js"></script>

ant design 没有失效
<script src="https://cdn.bootcdn.net/ajax/libs/antd/4.12.3/antd.min.js"></script>

二、装置第三方的插件

比方这个,装置react插件