index.js 1.0 KB

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