fa-add-my.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <view
  3. @tap="goAddMy"
  4. class="fa-add-my"
  5. :class="['fa-add-my--mode--' + mode]"
  6. :style="[
  7. {
  8. bottom: bottom + 'rpx',
  9. right: right + 'rpx',
  10. borderRadius: mode == 'circle' ? '10000rpx' : '8rpx',
  11. zIndex: zIndex
  12. },
  13. customStyle
  14. ]"
  15. >
  16. <view class="" v-if="!$slots.default">
  17. <u-icon :name="icon" :custom-style="iconStyle"></u-icon>
  18. <view class="fa-add-my__tips">{{ tips }}</view>
  19. </view>
  20. <slot v-else />
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. name: 'fa-add-my',
  26. props: {
  27. //类型,到不同的页面
  28. type: {
  29. type: String,
  30. default: ''
  31. },
  32. // 发布问题的形状,circle-圆形,square-方形
  33. mode: {
  34. type: String,
  35. default: 'circle'
  36. },
  37. // 自定义图标
  38. icon: {
  39. type: String,
  40. default: 'edit-pen'
  41. },
  42. // 提示文字
  43. tips: {
  44. type: String,
  45. default: ''
  46. },
  47. // 发布问题按钮到底部的距离,单位rpx
  48. bottom: {
  49. type: [Number, String],
  50. default: 300
  51. },
  52. // 发布问题按钮到右边的距离,单位rpx
  53. right: {
  54. type: [Number, String],
  55. default: 40
  56. },
  57. // 层级
  58. zIndex: {
  59. type: [Number, String],
  60. default: '9'
  61. },
  62. // 图标的样式,对象形式
  63. iconStyle: {
  64. type: Object,
  65. default() {
  66. return {
  67. color: '#909399',
  68. fontSize: '38rpx'
  69. };
  70. }
  71. },
  72. // 整个组件的样式
  73. customStyle: {
  74. type: Object,
  75. default() {
  76. return {};
  77. }
  78. }
  79. },
  80. data() {
  81. return {};
  82. },
  83. methods: {
  84. goAddMy() {
  85. if (this.type == 'custom') {
  86. this.$emit('custom');
  87. return;
  88. }
  89. this.$u.route(`/pages/score/order`);
  90. }
  91. }
  92. };
  93. </script>
  94. <style lang="scss" scoped>
  95. .fa-add-my {
  96. width: 80rpx;
  97. height: 80rpx;
  98. position: fixed;
  99. z-index: 9;
  100. display: flex;
  101. flex-direction: column;
  102. justify-content: center;
  103. background-color: #e1e1e1;
  104. color: $u-content-color;
  105. align-items: center;
  106. transition: opacity 0.4s;
  107. &__tips {
  108. font-size: 24rpx;
  109. transform: scale(0.8);
  110. line-height: 1;
  111. }
  112. }
  113. </style>