提交 1e9f7fcd 编写于 作者: View Design's avatar View Design

hack

上级 15828470
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
:padded="false" :padded="false"
variant="none" variant="none"
maxlength="2000" maxlength="2000"
@focus="handleInputFocus"
@blur="handleInputBlur"
/> />
<div class="flex flex-shrink-0 gap-2"> <div class="flex flex-shrink-0 gap-2">
<UButton <UButton
...@@ -52,14 +54,23 @@ const props = defineProps({ ...@@ -52,14 +54,23 @@ const props = defineProps({
} }
}) })
const emits = defineEmits(['ask', 'stop']) const emits = defineEmits(['ask', 'stop'])
const cardUI = { const isFocus = ref(false)
const cardUI = computed(() => {
const base = {
body: { body: {
padding: '', padding: '',
base: 'flex items-end has-[textarea[rows="1"]]:items-center pl-4 pr-1 py-1 gap-2' base: 'flex items-end has-[textarea[rows="1"]]:items-center pl-4 pr-1 py-1 gap-2'
}, },
base: 'transition-[width] w-3/5 has-[textarea:focus]:w-full has-[button:focus]:w-full', // base: 'transition-[width] w-3/5 has-[textarea:focus]:w-full has-[button:focus]:w-full',
rounded: 'rounded has-[textarea[rows="1"]]:rounded-full' rounded: 'rounded has-[textarea[rows="1"]]:rounded-full'
} }
if (isFocus.value) {
base.base = 'transition-[width] w-full'
} else {
base.base = 'transition-[width] w-3/5'
}
return base
})
defineShortcuts({ defineShortcuts({
meta_enter: { meta_enter: {
usingInput: 'queryInput', usingInput: 'queryInput',
...@@ -96,4 +107,12 @@ function handleAsk () { ...@@ -96,4 +107,12 @@ function handleAsk () {
handleBlur() handleBlur()
} }
const queryInput = ref(null) const queryInput = ref(null)
function handleInputFocus () {
isFocus.value = true
}
function handleInputBlur () {
setTimeout(() => {
isFocus.value = false
}, 100)
}
</script> </script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册