作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我在 Webstorm 中使用 vue 框架,使用 ES6 语法。
我已经安装了 vue-for-idea
插件,如果我使用纯 ES5 语法,一切都会很顺利。
但是代码的ES6部分似乎还没有被识别,并被高亮警告:
例如这段代码:
<script>
import { DeUser } from '../api/resource';
export default{
.....
ready() {
// Warned by: The expression statement is not assignment in this code
DeUser.get().then((resp) => {
console.log(resp);
});
},
</script>
我完美地运行了我的项目并得到了正确的resp,但是WebStorm 提示我表达式语句不是赋值,我该如何解决?
最佳答案
终于有了一个简单的解决方案,在你的.vue
文件,只需添加 lang="babel"
作为 <script>
中的一个属性标签:
<template>
<!-- markup content -->
</template>
<script lang="babel">
</script>
关于syntax - WebStorm/JetBrains : cannot recognize es6 syntax in a . vue文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38135966/
我是一名优秀的程序员,十分优秀!