props.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * @Author : LQ
  3. * @Description :
  4. * @version : 1.0
  5. * @Date : 2021-08-16 10:04:04
  6. * @LastAuthor : LQ
  7. * @lastTime : 2021-08-16 10:04:24
  8. * @FilePath : /u-view2.0/uview-ui/components/u-button/props.js
  9. */
  10. import { defineProps } from '../../libs/util/props';
  11. export default defineProps('button', {
  12. // 是否细边框
  13. hairline: {
  14. type: Boolean,
  15. default: false
  16. },
  17. // 按钮的预置样式,info,primary,error,warning,success
  18. type: {
  19. type: String,
  20. default: 'default'
  21. },
  22. // 按钮类型,text,default
  23. round: {
  24. type: [String, Number],
  25. default: 3
  26. },
  27. // 按钮尺寸,large,normal,small,mini
  28. size: {
  29. type: String,
  30. default: 'normal'
  31. },
  32. // 按钮形状,circle(两边为半圆),square(带圆角)
  33. shape: {
  34. type: String,
  35. default: 'square'
  36. },
  37. // 按钮是否镂空
  38. plain: {
  39. type: Boolean,
  40. default: false
  41. },
  42. // 是否禁止状态
  43. disabled: {
  44. type: Boolean,
  45. default: false
  46. },
  47. // 是否加载中
  48. loading: {
  49. type: Boolean,
  50. default: false
  51. },
  52. // 加载中提示文字
  53. loadingText: {
  54. type: [String, Number],
  55. default: ''
  56. },
  57. // 加载状态图标类型
  58. loadingMode: {
  59. type: String,
  60. default: 'spinner'
  61. },
  62. // 加载图标大小
  63. loadingSize: {
  64. type: [String, Number],
  65. default: 15
  66. },
  67. // 开放能力,具体请看uniapp稳定关于button组件部分说明
  68. // https://uniapp.dcloud.io/component/button
  69. openType: {
  70. type: String,
  71. default: ''
  72. },
  73. // 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
  74. // 取值为submit(提交表单),reset(重置表单)
  75. formType: {
  76. type: String,
  77. default: ''
  78. },
  79. // 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
  80. // 只微信小程序、QQ小程序有效
  81. appParameter: {
  82. type: String,
  83. default: ''
  84. },
  85. // 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效
  86. hoverStopPropagation: {
  87. type: Boolean,
  88. default: true
  89. },
  90. // 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效
  91. lang: {
  92. type: String,
  93. default: 'en'
  94. },
  95. // 会话来源,open-type="contact"时有效。只微信小程序有效
  96. sessionFrom: {
  97. type: String,
  98. default: ''
  99. },
  100. // 会话内消息卡片标题,open-type="contact"时有效
  101. // 默认当前标题,只微信小程序有效
  102. sendMessageTitle: {
  103. type: String,
  104. default: ''
  105. },
  106. // 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
  107. // 默认当前分享路径,只微信小程序有效
  108. sendMessagePath: {
  109. type: String,
  110. default: ''
  111. },
  112. // 会话内消息卡片图片,open-type="contact"时有效
  113. // 默认当前页面截图,只微信小程序有效
  114. sendMessageImg: {
  115. type: String,
  116. default: ''
  117. },
  118. // 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,
  119. // 用户点击后可以快速发送小程序消息,open-type="contact"时有效
  120. showMessageCard: {
  121. type: Boolean,
  122. default: false
  123. },
  124. // 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取
  125. dataName: {
  126. type: String,
  127. default: ''
  128. },
  129. // 节流,一定时间内只能触发一次
  130. throttleTime: {
  131. type: [String, Number],
  132. default: 0
  133. },
  134. // 按住后多久出现点击态,单位毫秒
  135. hoverStartTime: {
  136. type: [String, Number],
  137. default: 0
  138. },
  139. // 手指松开后点击态保留时间,单位毫秒
  140. hoverStayTime: {
  141. type: [String, Number],
  142. default: 200
  143. },
  144. // 按钮文字,之所以通过props传入,是因为slot传入的话
  145. // nvue中无法控制文字的样式
  146. text: {
  147. type: [String, Number],
  148. default: ''
  149. },
  150. // 按钮图标
  151. icon: {
  152. type: String,
  153. default: ''
  154. },
  155. // 按钮图标
  156. iconColor: {
  157. type: String,
  158. default: ''
  159. },
  160. // 按钮图标位置:left, right
  161. iconPosition: {
  162. type: String,
  163. default: 'left'
  164. },
  165. // 按钮颜色,支持传入linear-gradient渐变色
  166. color: {
  167. type: String,
  168. default: ''
  169. }
  170. })