ElementUI 原生方法添加参数

56 阅读1分钟

ElementUI 原生方法添加参数 ElementUI 源代码中的方法入参是固定的,在多选框过滤方法中,默认参数是 val 和 item,不够满足需求。

想要动态添加方法入参,可以这样传递:

:filter-method="(val, item) => {return dataFilter(val, item, tableData[scope.$index])}"
<el-select v-model="tableData[scope.$index].value"
           filterable
           size="mini"
           :filter-method="(val, item) => {return dataFilter(val, item, tableData[scope.$index])}"
           :visible-change="recoverData"
           placeholder="请选择"
           :popper-append-to-body="false"
           popper-class="select-option"
           @change="showTableDate(scope.row)"
           @visible-change="recoverData(false, scope)"
           :disabled="tableData[scope.$index].isChange"
           slot="reference">
  <el-option
    v-for="item in valueOptions"
    :key="item.value"
    :label="item.label"
    :value="item.label">
  </el-option>
</el-select>