You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
5.5 KiB

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