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

163 行
5.8 KiB

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