天天看点

webStrom/phpStrom使用箭头函数报错解决方法

webStrom/phpStrom使用箭头函数报错

在webStrom/phpStrom下写箭头函数会出现代码爆红,但执行并不会出错。像这样:

webStrom/phpStrom使用箭头函数报错解决方法

解决方法

  1. 点击窗口左上角File->Setttings->Languages & FrameWorks->JavaScript
    webStrom/phpStrom使用箭头函数报错解决方法
  2. 在右边找到JavaScript Language version下拉框中版本改为ECMAScript6
  3. 将<script>改写成<script type=“text/ecmascript-6”>
    webStrom/phpStrom使用箭头函数报错解决方法
    这个时候就不会在报错了。
    webStrom/phpStrom使用箭头函数报错解决方法

继续阅读