当前位置: 首页> 科技> 互联网 > vue 企业网站模板_安徽网站建设公司哪家好_百度竞价托管_百度应用商店下载安装

vue 企业网站模板_安徽网站建设公司哪家好_百度竞价托管_百度应用商店下载安装

时间:2025/9/5 2:03:32来源:https://blog.csdn.net/Light_10/article/details/144827843 浏览次数:1次
vue 企业网站模板_安徽网站建设公司哪家好_百度竞价托管_百度应用商店下载安装
  1. 不使用 el-popover 组件,而是手动创建一个 div 作为 Popover

    <template><el-table :data="tableData"><!-- ...其他列 --><el-table-column label="操作"><template slot-scope="scope"><div class="popover-trigger" @click="showPopover(scope.$index)">显示 Popover</div><div class="popover" v-show="scope.row.showPopover" ref="popover">这里是一些内容<el-button size="mini" @click="hidePopover(scope.$index)">关闭</el-button></div></template></el-table-column></el-table>
    </template>
  2. 使用 CSS 控制 Popover 的样式

    .popover {position: absolute;z-index: 100;background-color: #fff;border: 1px solid #ccc;padding: 10px;display: none; /* 默认不显示 */
    }
  3. 在 Vue 方法中控制显示和隐藏

    export default {data() {return {tableData: [// ...表格数据{ showPopover: false },// ...其他行数据],};},methods: {showPopover(index) {const popover = this.$refs.popover[index];const trigger = this.$el.querySelector(`.popover-trigger`); // 假设每个触发器都有这个类名if (trigger) {popover.style.left = `${trigger.offsetLeft}px`;popover.style.top = `${trigger.offsetTop + trigger.offsetHeight}px`;popover.style.display = 'block';}this.tableData[index].showPopover = true;},hidePopover(index) {this.tableData[index].showPopover = false;}}
    };
关键字:vue 企业网站模板_安徽网站建设公司哪家好_百度竞价托管_百度应用商店下载安装

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: