Popover (Element)

Popover 的屬性與 Tooltip 很類似,它們都是基于Vue-popper開發(fā)的,因此對于重復(fù)屬性,請參考 Tooltip 的文檔,在此文檔中不做詳盡解釋。

trigger屬性用于設(shè)置何時觸發(fā) Popover,支持四種觸發(fā)方式:hover,click,focus 和 manual。對于觸發(fā) Popover 的元素,有兩種寫法:使用 slot="reference" 的具名插槽,或使用自定義指令v-popover指向 Popover 的索引ref。

<template>
<el-popover
placement="top-start"
title="標(biāo)題"
width="200"
trigger="hover"
content="這是一段內(nèi)容,這是一段內(nèi)容,這是一段內(nèi)容,這是一段內(nèi)容。">
<el-button slot="reference">hover 激活</el-button>
</el-popover>
<el-popover
placement="bottom"
title="標(biāo)題"
width="200"
trigger="click"
content="這是一段內(nèi)容,這是一段內(nèi)容,這是一段內(nèi)容,這是一段內(nèi)容。">
<el-button slot="reference">click 激活</el-button>
</el-popover>
<el-popover
ref="popover"
placement="right"
title="標(biāo)題"
width="200"
trigger="focus"
content="這是一段內(nèi)容,這是一段內(nèi)容,這是一段內(nèi)容,這是一段內(nèi)容。">
</el-popover>
<el-button v-popover:popover>focus 激活</el-button>
<el-popover
placement="bottom"
title="標(biāo)題"
width="200"
trigger="manual"
content="這是一段內(nèi)容,這是一段內(nèi)容,這是一段內(nèi)容,這是一段內(nèi)容。"
v-model="visible">
<el-button slot="reference" @click="visible = !visible">手動激活</el-button>
</el-popover>
</template>
<script>
export default {
data() {
return {
visible: false
};
}
};
</script>

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容