Dialog.vue 1.0 KB

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