1. 程式人生 > >Error in render: "TypeError: _self.$scopedSlots.default is not a function"

Error in render: "TypeError: _self.$scopedSlots.default is not a function"

今天在做專案中遇到了如上圖這樣一個問題,專案是Vue+element-ui。原因是table中用了多個v-if,解決方案有兩個:

1、用v-show代替v-if(個人推薦用第二種);

2、在v-if條件語句中加key作為區分就不會報錯了。

<el-table
  :data="WarehousingDetails.productSkuVOList"
  :header-cell-style="getRowClassDialog"
  style="width: 100%">
    <el-table-column
     v-if="column == '' && column2 == ''"
     key='name'
     prop="goodsNames"
     label="名稱">
    </el-table-column>
    <el-table-column
      v-if="column != ''"
      :label="column">
        <template slot-scope="scope">
          <span>{{ scope.row.sku1Value }}</span>
        </template>
     </el-table-column>
     <el-table-column
       prop="sku2Value"
       v-if="column2 != ''"
       :label="column2">
     </el-table-column>
     <el-table-column
       prop="quantity"
       label="庫存數量">
     </el-table-column>
</el-table>