floatBut.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view>
  3. <view v-if="isSlot" class="box">
  4. <slot />
  5. </view>
  6. <view v-else class="float-but box" hover-class="navigator-hover" :style="{ 'z-index': zIndex }" @click.stop="click1">
  7. {{ text }}
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. name: "floatBut",
  14. props: {
  15. text: {
  16. type: String,
  17. default: "上传"
  18. },
  19. onClick: {
  20. type: Function
  21. },
  22. zIndex: {
  23. type: [String, Number],
  24. default: 99
  25. },
  26. isSlot: {
  27. type: Boolean,
  28. default: false
  29. }
  30. },
  31. data() {
  32. return {
  33. }
  34. },
  35. methods: {
  36. click1() {
  37. this.$emit("onClick")
  38. }
  39. },
  40. }
  41. </script>
  42. <style lang="scss" scoped>
  43. .float-but {
  44. width: 56px;
  45. height: 56px;
  46. line-height: 56px;
  47. text-align: center;
  48. background: radial-gradient(100% 0% at 50% 50%, #E2041E 0%, #C30D23 100%);
  49. border-radius: 50%;
  50. font-family: Source Han Sans SC, Source Han Sans SC;
  51. font-weight: bold;
  52. font-size: 16px;
  53. color: #FFFFFF;
  54. }
  55. .box {
  56. position: fixed;
  57. bottom: 120px;
  58. right: 10px;
  59. }
  60. </style>