PopoverButton.vue 994 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <el-popover
  3. class="popover-button"
  4. placement="top"
  5. width="240"
  6. v-model="visible"
  7. >
  8. <p><i class="el-icon-info color-warning"></i> {{ confirmText }}</p>
  9. <br />
  10. <div style="text-align: right; margin: 0">
  11. <el-button size="mini" @click="visible = false">取消</el-button>
  12. <el-button type="primary" size="mini" @click="confirm">确定</el-button>
  13. </div>
  14. <el-button
  15. class="btn--danger font-bold"
  16. type="text"
  17. icon="el-icon-delete"
  18. slot="reference"
  19. >{{ btnName }}</el-button
  20. >
  21. </el-popover>
  22. </template>
  23. <script>
  24. export default {
  25. name: "popover-button",
  26. props: {
  27. confirmText: {
  28. type: String,
  29. default: "你确定要删除当前记录吗?"
  30. },
  31. btnName: {
  32. type: String,
  33. default: "删除"
  34. }
  35. },
  36. data() {
  37. return {
  38. visible: false
  39. };
  40. },
  41. methods: {
  42. confirm() {
  43. this.visible = false;
  44. this.$emit("confirm");
  45. }
  46. }
  47. };
  48. </script>