form-input.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div>
  3. <div class="card-title">
  4. {{ props.title }}
  5. </div>
  6. <div class="form-input-box">
  7. <input
  8. v-model="text"
  9. class="form-input"
  10. >
  11. <button
  12. class="form-button"
  13. :disabled="disabled"
  14. @click="listItemClick"
  15. />
  16. </div>
  17. </div>
  18. </template>
  19. <script lang="ts">
  20. import vue from '../../adapter-vue';
  21. const { ref } = vue;
  22. interface Props {
  23. title: string;
  24. }
  25. export default {
  26. props: {
  27. title: {
  28. type: String,
  29. default: '',
  30. },
  31. },
  32. emits: ['input-submit'],
  33. setup(props: Props, { emit }) {
  34. const disabled = ref<boolean>(false);
  35. const text = ref<string>('');
  36. const listItemClick = (): void => {
  37. disabled.value = true;
  38. emit('input-submit', text.value);
  39. };
  40. return {
  41. disabled,
  42. text,
  43. listItemClick,
  44. props,
  45. };
  46. },
  47. };
  48. </script>
  49. <style lang="scss">
  50. .card-title {
  51. margin-bottom: 8px;
  52. }
  53. .form-input-box {
  54. display: flex;
  55. button:disabled {
  56. background: #d8d8d8;
  57. }
  58. }
  59. .form-input {
  60. width: 100%;
  61. height: 36px;
  62. border-radius: 8px 0 0 8px;
  63. border: 1px rgba(221, 221, 221, 1) solid;
  64. }
  65. .form-button {
  66. position: relative;
  67. height: 40px;
  68. width: 42px;
  69. font-size: 16px;
  70. border-radius: 0 8px 8px 0;
  71. border: 0 rgba(221, 221, 221, 1) solid;
  72. background: #006eff;
  73. color: white;
  74. cursor: pointer;
  75. }
  76. .form-button::before {
  77. content: '';
  78. position: absolute;
  79. width: 10px;
  80. height: 10px;
  81. top: 50%;
  82. right: 40%;
  83. border-left: 2px solid #FFF;
  84. border-bottom: 2px solid #FFF;
  85. transform: translate(0, -50%) rotate(-135deg);
  86. }
  87. </style>