選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import baseComponent from '../helpers/baseComponent'
  2. import classNames from '../helpers/classNames'
  3. baseComponent({
  4. useFieldButton: true,
  5. properties: {
  6. prefixCls: {
  7. type: String,
  8. value: 'wux-button',
  9. },
  10. type: {
  11. type: String,
  12. value: 'stable',
  13. },
  14. clear: {
  15. type: Boolean,
  16. value: false,
  17. },
  18. block: {
  19. type: Boolean,
  20. value: false,
  21. },
  22. full: {
  23. type: Boolean,
  24. value: false,
  25. },
  26. outline: {
  27. type: Boolean,
  28. value: false,
  29. },
  30. bordered: {
  31. type: Boolean,
  32. value: true,
  33. },
  34. shape: {
  35. type: String,
  36. value: 'default',
  37. },
  38. size: {
  39. type: String,
  40. value: 'default',
  41. },
  42. disabled: {
  43. type: Boolean,
  44. value: false,
  45. },
  46. loading: {
  47. type: Boolean,
  48. value: false,
  49. },
  50. formType: {
  51. type: String,
  52. value: '',
  53. },
  54. openType: {
  55. type: String,
  56. value: '',
  57. },
  58. hoverClass: {
  59. type: String,
  60. value: 'default',
  61. },
  62. hoverStopPropagation: {
  63. type: Boolean,
  64. value: false,
  65. },
  66. hoverStartTime: {
  67. type: Number,
  68. value: 20,
  69. },
  70. hoverStayTime: {
  71. type: Number,
  72. value: 70,
  73. },
  74. lang: {
  75. type: String,
  76. value: 'en',
  77. },
  78. sessionFrom: {
  79. type: String,
  80. value: '',
  81. },
  82. sendMessageTitle: {
  83. type: String,
  84. value: '',
  85. },
  86. sendMessagePath: {
  87. type: String,
  88. value: '',
  89. },
  90. sendMessageImg: {
  91. type: String,
  92. value: '',
  93. },
  94. showMessageCard: {
  95. type: Boolean,
  96. value: false,
  97. },
  98. appParameter: {
  99. type: String,
  100. value: '',
  101. },
  102. },
  103. computed: {
  104. classes: ['prefixCls, hoverClass, type, shape, size, block, full, clear, outline, bordered, disabled', function(prefixCls, hoverClass, type, shape, size, block, full, clear, outline, bordered, disabled) {
  105. const finalShape = ['rounded', 'rectangular'].includes(shape) ? shape : ''
  106. const finalSize = ['small', 'large'].includes(size) ? size : ''
  107. const wrap = classNames(prefixCls, {
  108. [`${prefixCls}--${type}`]: type,
  109. [`${prefixCls}--${shape}`]: finalShape,
  110. [`${prefixCls}--${size}`]: finalSize,
  111. [`${prefixCls}--block`]: block,
  112. [`${prefixCls}--full`]: full,
  113. [`${prefixCls}--clear`]: clear,
  114. [`${prefixCls}--outline`]: outline,
  115. [`${prefixCls}--bordered`]: bordered,
  116. [`${prefixCls}--disabled`]: disabled,
  117. })
  118. const hover = hoverClass && hoverClass !== 'default' ? hoverClass : `${prefixCls}--hover`
  119. return {
  120. wrap,
  121. hover,
  122. }
  123. }],
  124. },
  125. methods: {
  126. onTap() {
  127. if (!this.data.disabled && !this.data.loading) {
  128. this.triggerEvent('click')
  129. }
  130. },
  131. bindgetuserinfo(e) {
  132. this.triggerEvent('getuserinfo', e.detail)
  133. },
  134. bindcontact(e) {
  135. this.triggerEvent('contact', e.detail)
  136. },
  137. bindgetphonenumber(e) {
  138. this.triggerEvent('getphonenumber', e.detail)
  139. },
  140. bindopensetting(e) {
  141. this.triggerEvent('opensetting', e.detail)
  142. },
  143. bindlaunchapp(e) {
  144. this.triggerEvent('launchapp', e.detail)
  145. },
  146. bindchooseavatar(e) {
  147. this.triggerEvent('chooseavatar', e.detail)
  148. },
  149. onError(e) {
  150. this.triggerEvent('error', e.detail)
  151. },
  152. },
  153. })