关于 vue3运行报错Internal server error: [@vue/compiler-sfc] <script setup> cannot contain ES 的处理方法
大致的意思就是 script setup不能使用ES模块导出其实问题就出在,给官方给出的方法混用了标签里面配置setup类里配置setup()方法两者用一种就行了。
文章共148字 · 阅读需要大约1分钟
一键AI生成摘要,助你高效阅读
问答
·
大致的意思就是 script setup 不能使用ES模块导出
其实问题就出在,给官方给出的方法混用了
一种是:<script>
标签里面配置 setup
另一种是:export default
类里配置 setup()
方法
两者用一种就行了
第一种
<script setup> import {useStore} from "../stores/store.js"; const store = useStore(); </script>
第二种
<script> import { defineComponent } from 'vue' import {useStore} from "../stores/store.js"; export default defineComponent({ setup() { const store = useStore(); return { store, } } }) </script>
更多推荐
已为社区贡献1条内容
所有评论(0)