![关于 vue3运行报错Internal server error: [@vue/compiler-sfc] <script setup> cannot contain ES 的处理方法 关于 vue3运行报错Internal server error: [@vue/compiler-sfc] <script setup> cannot contain ES 的处理方法](https://ajaa.cn/zb_users/upload/2024/02/20240225073121170881748158171.jpg)
大致的意思就是 script setup 不能使用ES模块导出
其实问题就出在,给官方给出的方法混用了
一种是:<script> 标签里面配置 setup
另一种是:export default 类里配置 setup() 方法
两者用一种就行了
第一种
<script setup>
import {useStore} from "../stores/store.js";
const store = useStore();
</script>
第二种
<script>
import { define***ponent } from 'vue'
import {useStore} from "../stores/store.js";
export default define***ponent({
setup() {
const store = useStore();
return {
store,
}
}
})
</script>