dk-button.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*******************************************************************************
  2. * Copyright(c) 2022 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:
  5. * 2.功能描述:dkButton组件
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * admin 2022-11-17 1.00 新建
  9. *******************************************************************************/
  10. import { button } from '../../../dist/mixins/button';
  11. import { openType } from '../../../dist/mixins/open-type';
  12. Component({
  13. //组件代码共享的特性
  14. behaviors: [button, openType],
  15. /**
  16. * 组件的属性列表
  17. */
  18. properties: {
  19. formType: String,//用于 form 组件,可选值为submit reset,点击分别会触发 form 组件的 submit/reset 事件
  20. icon: String,//左侧图标名称或图片链接,可选值见 Icon 组件
  21. //图标类名前缀,同 Icon 组件的 class-prefix 属性
  22. classPrefix: {
  23. type: String,
  24. value: 'van-icon',
  25. },
  26. plain: Boolean,//是否为朴素按钮
  27. block: Boolean,//是否为块级元素
  28. round: Boolean,//是否为圆形按钮
  29. square: Boolean,//是否为方形按钮
  30. loading: Boolean,//是否显示为加载状态
  31. hairline: Boolean,//是否使用 0.5px 边框
  32. disabled: Boolean,//是否禁用按钮
  33. loadingText: String,//加载状态提示文字
  34. customStyle: String,//自定义样式
  35. //加载状态图标类型,可选值为 spinner
  36. loadingType: {
  37. type: String,
  38. value: 'circular',
  39. },
  40. //按钮类型,可选值为 primary info warning danger
  41. type: {
  42. type: String,
  43. value: 'default',
  44. },
  45. //按钮 dataset,open-type 为 share 时,可在 onShareAppMessage 事件的 event.target.dataset.detail 中看到传入的值
  46. dataset: null,
  47. //按钮尺寸,可选值为 normal large small mini
  48. size: {
  49. type: String,
  50. value: 'normal',
  51. },
  52. //加载图标大小
  53. loadingSize: {
  54. type: String,
  55. value: '20px',
  56. },
  57. //按钮颜色,支持传入linear-gradient渐变色
  58. color: String,
  59. },
  60. /**
  61. * 组件的初始数据
  62. */
  63. data: {
  64. text: ''
  65. },
  66. /**
  67. * 组件的方法列表
  68. */
  69. methods: {
  70. // 方法继承opentype ../../dist/mixins/open-type
  71. onClick(e){
  72. this.triggerEvent("click",e)
  73. }
  74. }
  75. })