popup.vue 863 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <uni-popup ref="alertDialog" type="dialog">
  3. <uni-popup-dialog :type="popupInfo.msgType" :cancelText="popupInfo.cancelText" :confirmText="popupInfo.confirmText" :title="popupInfo.title" :content="popupInfo.content" @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
  4. </uni-popup>
  5. </template>
  6. <script>
  7. export default {
  8. props: {
  9. popupInfo: {
  10. type: Object,
  11. default: () => ({
  12. msgType: 'success',
  13. cancelText: '关闭',
  14. confirmText: '确认',
  15. title: '通知',
  16. content: '默认消息'
  17. })
  18. }
  19. },
  20. data () {
  21. return {}
  22. },
  23. mounted() {},
  24. methods: {
  25. dialogConfirm() {
  26. this.$emit('confirm')
  27. },
  28. dialogClose() {
  29. this.$emit('close')
  30. },
  31. open() {
  32. this.$refs.alertDialog.open()
  33. },
  34. close() {
  35. this.$refs.alertDialog.close()
  36. }
  37. }
  38. }
  39. </script>
  40. <style>
  41. </style>