show-info.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view style="position: relative;">
  3. <uni-icons @mouseenter.native="mouseenter" @mouseleave.native="showStableInfo = false"
  4. style="padding:0 10px;color: #a8a8a8;cursor: pointer;" type="info" />
  5. <view v-if="showStableInfo" class="show-stable" :style="{top:`${top}px`,left:`${left}px`,width:`${width}px`}">
  6. <text>{{content}}</text>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. props: {
  13. content: String,
  14. top: {
  15. type: [Number, String],
  16. default: -60
  17. },
  18. left: {
  19. type: [Number, String],
  20. default: -100
  21. },
  22. width: {
  23. type: [Number, String],
  24. default: 200
  25. }
  26. },
  27. data() {
  28. return {
  29. showStableInfo: false,
  30. arrowStyle: {}
  31. }
  32. },
  33. methods: {
  34. mouseenter(e) {
  35. this.showStableInfo = true
  36. }
  37. }
  38. }
  39. </script>
  40. <style lang="scss" scoped>
  41. $main_color: #fff;
  42. $main_back_color: #303133;
  43. .show-stable {
  44. position: absolute;
  45. padding: 5px 10px;
  46. background-color: $main_back_color;
  47. color: $main_color;
  48. border-radius: 4px;
  49. border: 1px solid #e9e9eb;
  50. z-index: 99999;
  51. }
  52. </style>