我在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>我完美地运行了我的项目,并正确地获得了响应,但WebStorm向我显示了表达式语句不是赋值的提示,我如何解决它?
发布于 2016-07-01 17:26:02
最终得到了一个简单的解决方案,在.vue文件中,只需将lang="babel"作为属性添加到<script>标记中:
<template>
<!-- markup content -->
</template>
<script lang="babel">
</script>发布于 2016-12-28 21:15:18
您可以将文本“babel”或type=“lang=/ecmascript-6”添加到标签中。
<script lang="babel">
</script>或者:
<script type="text/ecmascript-6">
</script>另外,Visual Studio Code有一些很好的vue插件,你可以试试。
https://stackoverflow.com/questions/38135966
复制相似问题