Vue3组件Props属性名不能与Setup()中变量名不可重复
npm run lint,显示错误点:
30:9 error Getting a value from the `props` in root scope of `setup()` will cause the value to lose reactivity vue/no-setup-props-destructure
查看第30行代码:
setup ( props ) => {....let total = props.total....}
原因是变更名“total”与“ props.total”同名了,npm run serve编译通过,但运行npm run lint或npm run build,会报错。
另外,在return { total },也会报错,所以在返回值中不能重复输出total。
浙公网安备 33010602011771号