1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { VantComponent } from '../common/component';
  2. import { iphonex } from '../mixins/iphonex';
  3. VantComponent({
  4. mixins: [iphonex],
  5. props: {
  6. show: Boolean,
  7. title: String,
  8. cancelText: String,
  9. zIndex: {
  10. type: Number,
  11. value: 100
  12. },
  13. actions: {
  14. type: Array,
  15. value: []
  16. },
  17. overlay: {
  18. type: Boolean,
  19. value: true
  20. },
  21. closeOnClickOverlay: {
  22. type: Boolean,
  23. value: true
  24. }
  25. },
  26. methods: {
  27. onSelect(event) {
  28. const { index } = event.currentTarget.dataset;
  29. const item = this.data.actions[index];
  30. if (item && !item.disabled && !item.loading) {
  31. this.$emit('select', item);
  32. }
  33. },
  34. onCancel() {
  35. this.$emit('cancel');
  36. },
  37. onClose() {
  38. this.$emit('close');
  39. }
  40. }
  41. });