Skip to content

ESLint: Getting a value from the props in root scope of <script setup> will cause the value to lose reactivity.(vue/no-setup-props-destructure)

在vue3中,如果将props里定义的值,直接赋值给定义的变量,比如const a = ref(props.a) 这时就会报上面的错误

解决办法是通过computed将props里的值赋值给新定义的变量

const a = computed(() => props.a)

如有转载或 CV 的请标注本站原文地址