天天看點

vue.js+elementUI中插槽的使用插槽

插槽

條件判斷

<el-table-column label="是否管理人員" align="center" width="100">
    <template slot-scope="scope">
      <p v-text="scope.row.isManage == 1 ? '是' : '否'"></p> 
    </template>
  </el-table-column>
           

字典比對

<el-table-column label="職工身份" align="center" width="80"
    ><template slot-scope="scope">
      {{ employeeStatuse[parseInt(scope.row.identityNo) - 1] }}
    </template>
  </el-table-column>
           

單擊事件

<el-table-column width="100" label="操作" align="center">
    <template slot-scope="scope">
      <div
        style="color: #1890ff; cursor: pointer"
        @click="goPath('details', scope.row.id)"
      >
        詳情/修改
      </div>
    </template>
  </el-table-column>
           

按鈕

<el-table-column
    label="操作"
    align="center"
    width="120"
    class-name="small-padding fixed-width"
  >
    <template slot-scope="scope">
      <el-button
        size="mini"
        type="text"
        icon="el-icon-edit"
        @click="handleUpdate(scope.row)"
        >修改</el-button>
      <el-button
        size="mini"
        type="text"
        icon="el-icon-delete"
        @click="handleDelete(scope.row)"
        >删除</el-button>
    </template>
  </el-table-column>
</el-table>