FloatButton.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <view class="float-button">
  3. <u-button :type="type" :icon="icon" :shape="shape" :disabled="disabled" :size="size" @click="$emit('click')"></u-button>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. props: {
  9. // 按钮的预置样式,info,primary,error,warning,success
  10. type: {
  11. type: String,
  12. default: uni.$u.props.button.type
  13. },
  14. // 图标
  15. icon: {
  16. type: String
  17. },
  18. // 按钮尺寸,large,normal,small,mini
  19. size: {
  20. type: String,
  21. default: 'large'
  22. },
  23. // 按钮形状,circle(两边为半圆),square(带圆角)
  24. shape: {
  25. type: String,
  26. default: 'circle'
  27. },
  28. // 按钮是否镂空
  29. plain: {
  30. type: Boolean,
  31. default: uni.$u.props.button.plain
  32. },
  33. // 是否禁止状态
  34. disabled: {
  35. type: Boolean,
  36. default: uni.$u.props.button.disabled
  37. },
  38. }
  39. }
  40. </script>
  41. <style lang="scss" scoped>
  42. .float-button {
  43. bottom: 100px;
  44. right: 20px;
  45. width: 52px;
  46. height: 52px;
  47. position: fixed;
  48. z-index: 10;
  49. }
  50. </style>