vue+element 表格

1.編輯表格

在這裏插入圖片描述

<el-table-column prop="sort" label="排序" align="center">
  <template slot-scope="scope">
    <span v-show="NoEdit != scope.row.relationshipId">{{scope.row.sort}}<i class="el-icon-edit ml10 cursor" @click="NoEdit=scope.row.relationshipId"></i></span>
    <span v-show="NoEdit == scope.row.relationshipId">
      <el-input-number size='mini' :min='1' v-model="sort"></el-input-number>
      <i class="cursor ml10 colorblue" @click="savaSort(scope.row)">保存</i>
      <i class="cursor ml10 colorblue" @click="NoEdit=''">取消</i>
    </span>
  </template>
</el-table-column>

2.刪除確認提示

在這裏插入圖片描述

<template slot-scope="scope">
  <el-popover
    placement="top"
    width="160"
    :ref="scope.row.id"
    >
    <p>確認刪除嗎?</p>
    <div style="text-align: right; margin: 0">
      <el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
      <el-button type="text" size="mini" @click="edit(scope.row)">確定</el-button>
    </div>
    <el-button type="text" size="small" slot="reference" >刪除</el-button>
  </el-popover>      
  <el-divider direction="vertical" ></el-divider>
  <el-button type="text" size="small" >查看</el-button> 
</template>

//刪除
edit(row){
 this.$refs[data.rows[index].id].doClose()
},
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章