index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. okColor: {
  29. type: String,
  30. value: ''
  31. },
  32. cancelColor: {
  33. type: String,
  34. value: ''
  35. },
  36. // 按钮组,有此值时,不显示 ok 和 cancel 按钮
  37. actions: {
  38. type: Array,
  39. value: []
  40. },
  41. // horizontal || vertical
  42. actionMode: {
  43. type: String,
  44. value: 'horizontal'
  45. }
  46. },
  47. methods: {
  48. handleClickItem({
  49. currentTarget = {}
  50. }) {
  51. const dataset = currentTarget.dataset || {};
  52. const {
  53. index
  54. } = dataset;
  55. this.triggerEvent('click', {
  56. index
  57. });
  58. },
  59. handleClickOk() {
  60. this.triggerEvent('ok');
  61. },
  62. handleClickCancel() {
  63. this.triggerEvent('cancel');
  64. }
  65. }
  66. });