vue scope 升级 slot-scope

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chinafire525/article/details/83616770

Emitted value instead of an instance of Error) the "scope" attribute for scoped slots have been deprecated and replaced by "slot-scope" since 2.5. The new "slot-scope" attribute can also be used on plain elements in addition to <template> to denote scoped slots.

场景重现:
在git上克隆完同事上传的Vue项目,用VS Code运行时报错。

VS Code运行栏报错:
the "scope" attribute for scoped slots have been deprecated and replaced by "slot-scope" since 2.5.
The new "slot-scope" attribute can also be used on plain elements in addition to <template> to denote scoped slots.

原因:
"scope"标签自Vue 2.5版本后被遗弃,替代的新标签时"slot-scope",优先常看双方的Vue版本,可能是因为Vue版本不一致。
在我这种情况里,我得Vue版本为2.8.2,他的版本为2.3.3。所以同志们,协同开发之前,一定要记得跟好基友的版本一致啊!

解决方法:
待更新~目前貌似除了全局更换标签,把scope=“scope”更换为slot-scope="scope",没有其他方法了。以后有更好的方法再更新。

猜你喜欢

转载自blog.csdn.net/chinafire525/article/details/83616770