打包的时候,给了这个提示

`defineEmits` is a compiler macro and no longer needs to be imported.

[@vue/compiler-sfc] `defineProps` is a compiler macro and no longer needs to be imported.

然后在网上搜到答案了,

// 去掉主动导入
import { defineProps, defineEmits } from 'vue'; 

<script setup>
// 去掉主动导入,直接使用 defineProps
const props = defineProps({
  foo: String
})

const emit = defineEmits(['change', 'delete'])
</script>

bingo

Logo

前往低代码交流专区

更多推荐