message-input-button.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div :class="['message-input-button', !isPC && 'message-input-button-h5']">
  3. <button
  4. v-if="props.enableSend"
  5. class="message-input-button-cont"
  6. data-type="text"
  7. :disabled="false"
  8. @click="sendMessage"
  9. >
  10. <p class="message-input-button-hover">
  11. {{ TUITranslateService.t("TUIChat.按Enter发送,Ctrl+Enter换行") }}
  12. </p>
  13. {{ TUITranslateService.t("发送") }}
  14. </button>
  15. </div>
  16. </template>
  17. <script setup lang="ts">
  18. import { TUITranslateService } from '@tencentcloud/chat-uikit-engine';
  19. import { isPC } from '../../../utils/env';
  20. const props = defineProps({
  21. enableSend: {
  22. type: Boolean,
  23. default: true,
  24. },
  25. });
  26. const emits = defineEmits(['sendMessage']);
  27. const sendMessage = () => {
  28. emits('sendMessage');
  29. };
  30. </script>
  31. <style scoped lang="scss">
  32. @import "../../../assets/styles/common";
  33. .message-input-button {
  34. position: absolute;
  35. bottom: 20px;
  36. right: 20px;
  37. &-h5 {
  38. position: static;
  39. }
  40. &-cont {
  41. padding: 8px 20px;
  42. border-radius: 4px;
  43. border: none;
  44. font-size: 14px;
  45. text-align: center;
  46. line-height: 20px;
  47. font-weight: 400;
  48. background: #006eff;
  49. color: #fff;
  50. letter-spacing: 0;
  51. cursor: pointer;
  52. }
  53. &-hover {
  54. display: none;
  55. justify-content: center;
  56. align-items: center;
  57. position: absolute;
  58. right: 120%;
  59. word-break: keep-all;
  60. height: 30px;
  61. white-space: nowrap;
  62. top: 0;
  63. bottom: 0;
  64. margin: auto 0;
  65. padding: 5px 10px;
  66. border-radius: 3px;
  67. background: #000;
  68. color: #fff;
  69. opacity: 0.3;
  70. &::before {
  71. content: "";
  72. position: absolute;
  73. width: 0;
  74. height: 0;
  75. right: -20px;
  76. border: 10px solid transparent;
  77. border-left: 10px solid #000;
  78. }
  79. }
  80. &:hover {
  81. .message-input-button-hover {
  82. display: flex;
  83. }
  84. }
  85. }
  86. </style>