Element Popover 彈出框的使用示例
阿新 • • 發佈:2020-07-27
元件— 彈出框
基礎用法
<template> <el-popover placement="top-start" title="標題" width="200" trigger="hover" content="這是一段內容,這是一段內容,這是一段內容。"> <el-button slot="reference">hover 啟用</el-button> </el-popover> <el-popover placement="bottom" title="標題" width="200" trigger="click" content="這是一段內容,這是一段內容。"> <el-button slot="reference">click 啟用</el-button> </el-popover> <el-popover ref="popover" placement="right" title="標題" width="200" trigger="focus" content="這是一段內容,這是一段內容。"> </el-popover> <el-button v-popover:popover>focus 啟用</el-button> <el-popover placement="bottom" title="標題" width="200" trigger="manual" content="這是一段內容,這是一段內容。" v-model="visible"> <el-button slot="reference" @click="visible = !visible">手動啟用</el-button> </el-popover> </template> <script> export default { data() { return { visible: false }; } }; </script>
巢狀資訊
<el-popover placement="right" width="400" trigger="click"> <el-table :data="gridData"> <el-table-column width="150" property="date" label="日期"></el-table-column> <el-table-column width="100" property="name" label="姓名"></el-table-column> <el-table-column width="300" property="address" label="地址"></el-table-column> </el-table> <el-button slot="reference">click 啟用</el-button> </el-popover> <script> export default { data() { return { gridData: [{ date: '2016-05-02',name: '王小虎',address: '上海市普陀區金沙江路 1518 弄' },{ date: '2016-05-04',{ date: '2016-05-01',{ date: '2016-05-03',address: '上海市普陀區金沙江路 1518 弄' }] }; } }; </script>
巢狀操作
<el-popover placement="top" width="160" v-model="visible"> <p>這是一段內容這是一段內容確定刪除嗎?</p> <div style="text-align: right; margin: 0"> <el-button size="mini" type="text" @click="visible = false">取消</el-button> <el-button type="primary" size="mini" @click="visible = false">確定</el-button> </div> <el-button slot="reference">刪除</el-button> </el-popover> <script> export default { data() { return { visible: false,}; } } </script>
Attributes
Slot
Events
Element-UI表格點選Popover 彈出框確定取消
<el-table-column width="600"> <template slot-scope="scope"> <el-popover trigger="click" placement="top" width="450" @show="handleStatus(scope)" :ref="`popover-${scope.$index}`"> <div> <el-input type="textarea" :rows="5" maxlength="300" placeholder="請輸入內容" v-model="scope.row.spaceAllocatePrice"></el-input> </div> <div style="text-align: left; margin-top: 20px"> <el-button size="small" plain @click="cancelClick(scope)">取消</el-button> <el-button type="primary" size="small" @click="sureClick(scope)">確定</el-button> </div> <el-button slot="reference" type="text">說明</el-button> </el-popover> </template> </el-table-column>
cancelClick(scope){ this.$message('點選了取消操作'); scope._self.$refs[`popover-${scope.$index}`].doClose() },sureClick(scope){ // 可以在這裡執行刪除資料的回撥操作.......刪除操作...... this.$message({ message:"點選了確定操作了",type: 'success' }); scope._self.$refs[`popover-${scope.$index}`].doClose() },
到此這篇關於Element Popover 彈出框的使用示例的文章就介紹到這了,更多相關Element Popover 彈出框內容請搜尋我們以前的文章或繼續瀏覽下面的相關文章希望大家以後多多支援我們!