vue组件中使用lodash库导致jest报错
来源:2-10 钩子函数的作用域

慕婉清5985935
2023-06-04
myComponent.vue › should display the correct count
TypeError: Cannot read properties of undefined (reading 'isEmpty')
231 | }
232 | if (draggable) {
> 233 | if (!this.$lodash.isEmpty(a)```
lodash 在vue中时正常引入的
写回答
1回答
-
慕婉清5985935
提问者
2023-06-05
需设置 jest.setup.js 并在jest.config.js 中配置
setupFiles: ['<rootDir>/jest.setup.js']
00
相似问题