1 回答

TA贡献1817条经验 获得超6个赞
给个忠告,下次提问的时候,贴出来的代码一定要排好版,不然看着这么乱的代码,回答的心情都没了。已经手动帮你重新排版了下代码。
说正题。
Element UI里的 popover 除了可以使用 v-popover
来绑定外,还有另一种方式来实现,如果你稍微认真看文档,肯定能看到下面图中的内容。
图中说到的 slot=reference 就可以被利用起来。像你问题中的代码,就可以这样写。
<template slot-scope="scope">
<el-popover placement="top" width="160" trigger="click">
<el-input v-model="scope.row.quantity"></el-input>
<div style="margin-top:10px">
<el-button size="mini" style="float:left"
@click="cancelChange">取消</el-button>
<el-button size="mini" type="primary"
style="float:right"
@click="confirmChange(scope.$index, cart_list)">确认</el-button>
</div>
<el-button slot="reference" type="text" style="width:40px">
{{scope.row.quantity}}
</el-button>
</el-popover>
</template>
添加回答
举报