ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.12k stars 14.64k forks source link

[Bug Report] el-popconfirm事件绑定不生效 #19450

Open chinaguopeng opened 4 years ago

chinaguopeng commented 4 years ago

Element UI version

2.13.2

OS/Browsers version

window10 Microsoft Edge 版本 81.0.416.77 (官方内部版本) (64 位)

Vue version

2.6.11

Reproduction Link

https://github.com/chinaguopeng/element-el-popconfirm

Steps to reproduce

下载index.html 在浏览器打开

What is Expected?

点击确认按钮,事件生效

What is actually happening?

点击确认按钮,事件不生效

alberthuang24 commented 4 years ago

image

alberthuang24 commented 4 years ago

@chinaguopeng

可以自己实现一个组件重写 confirm 解决

<script>
    import { Popconfirm } from 'element-ui'

    export default {
        extends: Popconfirm,
        methods: {
            confirm() {
                this.visible = false;
                this.$emit('on-confirm');
            }
        },
        mounted () {

        }
    }
</script>

<style scoped>

</style>
<popconfirm
    confirmButtonText='OK'
    cancelButtonText='No, Thanks'
    icon="el-icon-info"
    v-on:on-confirm="truncateall"
    iconColor="red"
    title="Are you sure to clear all?"
>
    <el-button slot="reference" type="danger">CLEAR ALL</el-button>
</popconfirm>
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.