关于 vue3运行报错Internal server error: [@vue/compiler-sfc] <script setup> cannot contain ES 的处理方法

大致的意思就是 script setup  不能使用ES模块导出

其实问题就出在,给官方给出的方法混用了

一种是: 标签里面配置 setup

另一种是:export default 类里配置 setup() 方法

两者用一种就行了

第一种 

import {useStore} from "../stores/store.js";
const store = useStore();

第二种

import { defineComponent } from 'vue'
import {useStore} from "../stores/store.js";
export default defineComponent({
  setup() {
    const store = useStore();
    return {
      store,
    }
  }
})

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://www.net2asp.com/0b49f54ac3.html