美文网首页
2020-06-09

2020-06-09

作者: 沧海月明_9d1b | 来源:发表于2020-06-09 15:00 被阅读0次

element UI Popover组件遍历

<template>
    <div>
        <el-table
            stripe
            :data="tableData"
            tooltip-effect="dark"
            style="width: 100%"
        >
            <el-table-column label="名称" width="240">
                <template slot-scope="{row}">{{ row.name }}</template>
            </el-table-column>
            <el-table-column label="操作" width="120" fixed="right">
                <template slot-scope="scope">
                    <el-popover
                        popper-class="popover-class"
                        placement="bottom-end" 
                        width="180"
                        trigger="click"
                        :ref="'popover-' + `${scope.$index}`"
                    >
                        <p>请确定是否删除?</p>
                        <div>
                            <el-button
                                type="primary"
                                size="mini"
                                @click="deletData(scope.row);scope._self.$refs['popover-' + `${scope.$index}`].doClose()"
                            >确定</el-button>
                            <el-button
                                size="mini" @click="scope._self.$refs['popover-' + `${scope.$index}`].doClose()"
                            >取消</el-button>
                        </div>
                        <el-button type="text" slot="reference">删除</el-button> 
                    </el-popover>
                </template>
            </el-table-column>
        </el-table>
</div>
</template> 

<script>
export default {
     data() {
         return {
             tableData: [ { id: 1, name: "商品1" }, { id: 2, name: "商品2" } ] };
    },
     methods: {
         deletData() {}
     }
};
</script>

相关文章

网友评论

      本文标题:2020-06-09

      本文链接:https://www.haomeiwen.com/subject/jdbstktx.html