vue3.0 `defineEmits` is a compiler macro and no longer needs to be imported.
transforming (408) node_modules\naive-ui\es\progress\src\Progress.js[@vue/compiler-sfc] `defineEmits` is a compiler macro and no longer needs to be imported.[@vue/compiler-sfc] `defineProps` is a comp
·
打包的时候,给了这个提示
`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
更多推荐
已为社区贡献21条内容
所有评论(0)