我在测试使用 Vue utils 挂载的组件时遇到以下错误消息:
Avoid mutating a prop directly since the value will be overwritten
whenever the parent component re-renders.
Instead, use a data or computed property based on the prop's value. Prop being mutated: <prop name>
最佳答案
挂载待测组件时,为防止控制台显示错误信息,将sync
选项设置为false给mount
函数。另见 https://vue-test-utils.vuejs.org/api/options.html#sync
关于testing - 测试Vue.js(^2.5.*)组件时提示prop被突变如何处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54571129/