Vue 项目提示:`(Emitted value instead of an instance of Error) the “scope“ attribute for scoped slots

虾米哥 阅读:1480 2021-03-31 12:43:37 评论:0

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 n 
ot-scope" attribute can also be used on plain elements in addition to <template> to denote scoped slots.`

造成原因:

scope 属性在2.5以后的版本中已经废弃, 被 slot-scope 替代

办法解决:

检查下你的列表组件里,slot 里的 <template> 上面有个 scope 属性,你改成 slot-scope.

                    <el-table-column label="操作"> 
                            <template slot="scope"> 
                                <el-button type="primary" size="mini" @click="toEdit(scope.$index, scope.row)">编辑</el-button> 
                                <el-button type="primary" size="mini" @click="deleteAdmin(scope.$index, scope.row)">删除</el-button> 
                            </template> 
                        </el-table-column>

改成

                        <el-table-column label="操作"> 
                            <template slot-scope="scope"> 
                                <el-button type="primary" size="mini" @click="toEdit(scope.$index, scope.row)">编辑</el-button> 
                                <el-button type="primary" size="mini" @click="deleteAdmin(scope.$index, scope.row)">删除</el-button> 
                            </template> 
                        </el-table-column>

 

标签:VUE
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号