Dialog.vue 985 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <view v-if="showdialog">
  3. <van-dialog title="确定取消订单?"
  4. show-cancel-button="true"
  5. :show="showdialog"
  6. @cancel="cancelDialog" @confirm="confirmOrder"
  7. >
  8. </van-dialog>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. props:{
  14. orderCancel:{
  15. default: false,
  16. type: Boolean
  17. }
  18. },
  19. data() {
  20. return {
  21. showdialog: false
  22. }
  23. },
  24. watch:{
  25. 'orderCancel':function(val) {
  26. console.log("监听中")
  27. if(val) {
  28. this.showdialog = true;
  29. console.log(this.showdialog)
  30. }
  31. }
  32. },
  33. created() {
  34. console.log(this.orderCancel)
  35. },
  36. methods: {
  37. cancelDialog() {
  38. this.show = false;
  39. this.$emit('colseDialog')
  40. console.log("取消")
  41. console.log(this.orderCancel);
  42. },
  43. confirmOrder() {
  44. this.show = false;
  45. this.$emit('confirmPay')
  46. },
  47. }
  48. }
  49. </script>
  50. <style>
  51. .showdialog {
  52. width: 100%;
  53. height: 100vh;
  54. }
  55. </style>