index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. Component({
  2. externalClasses: ['i-class', 'i-class-mask'],
  3. properties: {
  4. visible: {
  5. type: Boolean,
  6. value: false
  7. },
  8. title: {
  9. type: String,
  10. value: ''
  11. },
  12. showOk: {
  13. type: Boolean,
  14. value: true
  15. },
  16. showCancel: {
  17. type: Boolean,
  18. value: true
  19. },
  20. okText: {
  21. type: String,
  22. value: '确定'
  23. },
  24. cancelText: {
  25. type: String,
  26. value: '取消'
  27. },
  28. // 按钮组,有此值时,不显示 ok 和 cancel 按钮
  29. actions: {
  30. type: Array,
  31. value: []
  32. },
  33. // horizontal || vertical
  34. actionMode: {
  35. type: String,
  36. value: 'horizontal'
  37. }
  38. },
  39. methods: {
  40. handleClickItem ({ currentTarget = {} }) {
  41. const dataset = currentTarget.dataset || {};
  42. const { index } = dataset;
  43. this.triggerEvent('click', { index });
  44. },
  45. handleClickOk () {
  46. this.triggerEvent('ok');
  47. },
  48. handleClickCancel () {
  49. this.triggerEvent('cancel');
  50. }
  51. }
  52. });