W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
點擊元素,彈出氣泡確認(rèn)框。
Popconfirm 的屬性與 Popover 很類似,因此對于重復(fù)屬性,請參考 Popover 的文檔,在此文檔中不做詳盡解釋。
在 Popconfirm 中,只有 title 屬性可用,content 屬性不會被展示。
<template>
<el-popconfirm title="這是一段內(nèi)容確定刪除嗎?">
<template #reference>
<el-button>刪除</el-button>
</template>
</el-popconfirm>
</template>
可以在 Popconfirm 中自定義內(nèi)容。
<template>
<el-popconfirm
confirmButtonText="好的"
cancelButtonText="不用了"
icon="el-icon-info"
iconColor="red"
title="這是一段內(nèi)容確定刪除嗎?"
>
<template #reference>
<el-button>刪除</el-button>
</template>
</el-popconfirm>
</template>
點擊按鈕觸發(fā)事件
<template>
<el-popconfirm
confirmButtonText="確定"
cancelButtonText="取消"
icon="el-icon-info"
iconColor="red"
title="這是一段內(nèi)容確定刪除嗎?"
@confirm="confirmEvent"
@cancel="cancelEvent"
>
<template #reference>
<el-button>刪除</el-button>
</template>
</el-popconfirm>
</template>
<script>
export default {
methods: {
confirmEvent() {
console.log('confirm!')
},
cancelEvent() {
console.log('cancel!')
},
},
}
</script>
參數(shù) | 說明 | 類型 | 可選值 | 默認(rèn)值 |
---|---|---|---|---|
title | 標(biāo)題 | String | — | — |
confirmButtonText | 確認(rèn)按鈕文字 | String | — | — |
cancelButtonText | 取消按鈕文字 | String | — | — |
confirmButtonType | 確認(rèn)按鈕類型 | String | — | Primary |
cancelButtonType | 取消按鈕類型 | String | — | Text |
icon | Icon | String | — | el-icon-question |
iconColor | Icon 顏色 | String | — | #f90 |
hideIcon | 是否隱藏 Icon | Boolean | — | false |
參數(shù) | 說明 |
---|---|
reference | 觸發(fā) Popconfirm 顯示的 HTML 元素 |
事件名稱 | 說明 | 回調(diào)參數(shù) |
---|---|---|
confirm | 點擊確認(rèn)按鈕時觸發(fā) | — |
cancel | 點擊取消按鈕時觸發(fā) | — |
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: