confirm-popup.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <uni-popup ref="popupRef">
  3. <view class="unopen-box">
  4. <view class="content">
  5. {{ content }}
  6. </view>
  7. <!-- @click.stop="" -->
  8. <view class="unopen-btns">
  9. <view class="unopen-btn" @click.stop="close()">
  10. 取消
  11. </view>
  12. <view class="unopen-btn" @click.stop="confirm()">
  13. 确认
  14. </view>
  15. </view>
  16. </view>
  17. </uni-popup>
  18. </template>
  19. <script>
  20. export default {
  21. name: "confirm-popup",
  22. props: {
  23. content: {
  24. type: String,
  25. default: '是否确认?'
  26. }
  27. },
  28. data() {
  29. return {
  30. };
  31. },
  32. mounted() {
  33. // this.$refs.popupRef.open()
  34. // this.open()
  35. },
  36. methods: {
  37. open() {
  38. this.$nextTick(() => {
  39. this.$refs.popupRef.open();
  40. })
  41. },
  42. close(){
  43. this.$refs.popupRef.close()
  44. },
  45. confirm(){
  46. this.close()
  47. this.$emit('confirm')
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss" scoped>
  53. .unopen-box {
  54. width: 600rpx;
  55. min-height: 320rpx;
  56. background-color: #fff;
  57. border-radius: 20rpx;
  58. overflow: hidden;
  59. padding: 50rpx 60rpx 40rpx;
  60. display: flex;
  61. flex-direction: column;
  62. justify-content: space-between;
  63. .content {
  64. text-align: center;
  65. font-size: 36rpx;
  66. }
  67. .unopen-btns{
  68. width: 100%;
  69. display: flex;
  70. justify-content: space-between;
  71. align-items: center;
  72. .unopen-btn{
  73. width: 220rpx;
  74. height: 80rpx;
  75. border-radius: 6rpx;
  76. text-align: center;
  77. line-height: 78rpx;
  78. color: #fff;
  79. font-size: 30rpx;
  80. border: 1rpx solid $Theme-Color;
  81. color: $Theme-Color;
  82. }
  83. .unopen-btn + .unopen-btn{
  84. color: #fff;
  85. background-color: $Theme-Color;
  86. }
  87. }
  88. }
  89. </style>