elementUI,Popover 弹出框,里面的表格点击后关闭弹窗

结论:使用  this.$refs.popover4.showPopper = false; 或者 document.body.click()

<template>
  <div class="icon-body">
    <el-popover ref="popover4" placement="right" width="150" trigger="click">
      <el-table :data="gridData" @cell-click="copyClick">
        <el-table-column
          width="100"
          property="name"
          label="姓名"
        ></el-table-column>
      </el-table>
      <el-button
        slot="reference"
        type="primary"
        style="width: 200px; margin-bottom: 20px"
        >按钮</el-button
      >
    </el-popover>
  </div>
</template>

<script>
export default {
  name: "IconSelect",
  data() {
    return {
      gridData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          address: "上海市普陀区金沙江路 1518 弄",
        },
      ],
    };
  },
  methods: {
    copyClick(row, column, cell, event) {
      this.$refs.popover4.showPopper = false;
      // document.body.click()
    },
  },
};
</script>

参考:https://www.cnblogs.com/js-liqian/p/12092514.html

posted @ 2020-11-12 09:17  伟笑  阅读(3721)  评论(0编辑  收藏  举报