折腾:
【已解决】npm WARN [email protected] requires a peer of vue@^2.5.2 but none was installed
期间,vue升级到2.5.2后,npm run dev出现警告:
➜ HeadquarterReport git:(permission-control) ✗ npm run dev > [email protected] dev /Users/crifan/dev/xxx > node build/dev-server.js > Starting dev server… WARNING Compiled with 6 warnings warning in ./src/views/table/index.vue (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. @ ./src/views/table/index.vue 6:0-222 @ ./src/views ^\.\/.*\.vue$ @ ./src/router/_import_development.js @ ./src/router/index.js @ ./src/main.js @ multi ./build/dev-client ./src/main.js |
好像是直接把scope改为slot-scope就可以了?
the scope attribute for scoped slots have been deprecated and replaced by slot-scope since 2.5
Vue 2.5 Scope attribute deprecated replaced by slot-scope · Issue #283 · ratiw/vuetable-2
“In 2.5, the scope attribute has been deprecated (it still works, but you will get a soft warning). Instead, we now use slot-scope to denote a scoped slot, and it can be used on a normal element/component in addition to <template>:
<comp>
<div slot-scope=”props”>
{{ props.msg }}
</div>
</comp>
Note that this change means that slot-scope is now a reserved attribute and can no longer be used as a component prop.
”
Vue2.5 scoped slots deprecated – Get Help – Vue Forum
Upgrading to Vue.js 2.5 ← Alligator.io
vue项目报错如下:(Emitted value instead of an instance of Error) – CSDN博客
“scope 属性在2.5以后的版本中已经废弃, 被 slot-scope 替代
slot-scope 不光可以用在 template 元素上,也可以用在其它元素”
所以就是直接换就好。
【总结】
把:
<template scope=”scope”> {{scope.$index}} </template> |
改为:
<template slot-scope=”scope”> {{scope.$index}} </template> |
即可。
转载请注明:在路上 » 【已解决】Vue警告:the scope attribute for scoped slots have been deprecated and replaced by slot-scope since 2.5