封装的组件custom-table.vue
<Table :loading="loading" :columns="columns" :data="data">
<template v-for="column in columns" :slot="column.slot?column.slot:''" slot-scope="params" >
<slot :name="column.slot?column.slot:''" v-bind="params" ></slot>
</template>
</Table>
调用:
<custom-table :columns="columns" :daya="tableData">
<template slot-scope="params" slot="operater">{{params.row.id}}</template> // 跟iview 官网table slot 一样的
</custom-table>
转自:https://www.cnblogs.com/XHappyness/p/13158737.html
浙公网安备 33010602011771号