feat: 调整
This commit is contained in:
48
src/renderer/views/home/components/ChatInputArea.vue
Normal file
48
src/renderer/views/home/components/ChatInputArea.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<template>
|
||||
<div class="h-[174px] bg-white rounded-lg border border-[#eef2f6] shadow-[0_1px_0_rgba(0,0,0,0.03)] p-[18px] mt-[8px] flex flex-col justify-between">
|
||||
<textarea
|
||||
rows="2"
|
||||
placeholder="给我发布或者布置任务xx"
|
||||
class="flex-1 resize-none outline-none text-sm"
|
||||
:value="modelValue"
|
||||
@input="onInput"
|
||||
@keydown.enter="onKeydownEnter"
|
||||
/>
|
||||
|
||||
<div class="flex justify-between items-end">
|
||||
<button @click="onAttach">
|
||||
<RiLink />
|
||||
</button>
|
||||
<button class="w-[48px] h-[48px] bg-[#F5F7FA] px-2.5 py-1.5 rounded-md flex items-center justify-center" @click="onSend">
|
||||
<RiStopFill v-if="isSendingMessage" />
|
||||
<RiSendPlaneFill v-else />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineProps, defineEmits } from 'vue'
|
||||
import { RiLink, RiSendPlaneFill, RiStopFill } from '@remixicon/vue'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: { type: String, default: '' },
|
||||
isSendingMessage: { type: Boolean, default: false },
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'send', 'attach'])
|
||||
|
||||
const onInput = (e: Event) => {
|
||||
const v = (e.target as HTMLTextAreaElement).value
|
||||
emit('update:modelValue', v)
|
||||
}
|
||||
|
||||
const onKeydownEnter = (e: KeyboardEvent) => {
|
||||
if ((e as KeyboardEvent).shiftKey) return
|
||||
e.preventDefault()
|
||||
emit('send')
|
||||
}
|
||||
|
||||
const onAttach = () => emit('attach')
|
||||
const onSend = () => emit('send')
|
||||
</script>
|
||||
Reference in New Issue
Block a user