vue components传值,在组件里页面使用 slot-scope,scope.row,报错?

作者站长头像
站长
· 阅读数 28
      <rightColumn
        :urlParams="urlParams"
        :equipmentList="equipmentList"
        :pipeDiameterLenghList="pipeDiameterLenghList"
        :unitList="unitList"
        :systemWarningInfo="systemWarningInfo"
        :modelTabsName="rightColumnTabsName"
        :pipeLenghHighDiffList="pipeLenghHighDiffList"
        :equipAttrubute="equipAttrubute"
      ></rightColumn>

vue3的版本我用的vue2写法,我在1个components里传了多个值,在rightColumn页面使用 slot-scope,

报错信息:Property "scope" was accessed during render but is not defined on instance.

很多警告信息:Unhandled error during execution of scheduler flush. This is likely a Vue internals bug.

            <el-table :data="pipeLenghHighDiffList" style="width: 100%">
              <!-- 检查项prop="checkItem" -->
              <el-table-column
                
                :label="`${$t('glsj.checkItem')}`"
              >
                <template slot-scope="scope">
                  <span>{{ scope.row.checkItem }}</span>
                </template>
              </el-table-column>

我尝试只传1个值,使用slot-scope="scope",取值scope.row,也报错。

<rightColumn
        :pipeLenghHighDiffList="pipeLenghHighDiffList"
      ></rightColumn>
回复
1个回答
avatar
test
2024-06-23

Vue 3 还有 slot-scope 这个属性?不是从 Vue 2.6 开始不就已经废弃了吗?只不过还是可以用。你如果说要在 Vue 3 中用作用域插槽就改用 v-slot 就好了呀。

作用域插槽 - 插槽 Slots | Vue.js#slot-scope 废弃 | API — Vue.js

回复
likes
适合作为回答的
  • 经过验证的有效解决办法
  • 自己的经验指引,对解决问题有帮助
  • 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
  • 询问内容细节或回复楼层
  • 与题目无关的内容
  • “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容