提交 6f13184d 编写于 作者: D DebugIsFalse

opt: 优化组件结构

上级 2bae02a5
...@@ -68,17 +68,6 @@ function handleCollapse (state) { ...@@ -68,17 +68,6 @@ function handleCollapse (state) {
} }
watch(() => props.collapse, () => { watch(() => props.collapse, () => {
openCollapse.value = props.collapse openCollapse.value = props.collapse
}) }, { immediate: true})
watch(
() => props.item.ansLoading,
(value, oldValue) => {
if (oldValue === undefined && value) {
setTimeout(() => {
handleCollapse(false)
}, 500)
}
},
{ immediate: true }
)
defineExpose({ handleCollapse }) defineExpose({ handleCollapse })
</script> </script>
...@@ -141,13 +141,7 @@ const scrollToView = () => { ...@@ -141,13 +141,7 @@ const scrollToView = () => {
} }
const handleReGenerate = () => { const handleReGenerate = () => {
const { question } = askingData.value const { question } = askingData.value
askingData.value = { askingData.value = { question, desLoading: true, collapse: true }
question,
desLoading: true
}
nextTick(() => {
askingData.value.collapse = true
})
generateFetchData(`根据上述回答,对问题"${question}"重新生成`) generateFetchData(`根据上述回答,对问题"${question}"重新生成`)
} }
...@@ -161,10 +155,7 @@ const createGenerateInitItem = (question) => { ...@@ -161,10 +155,7 @@ const createGenerateInitItem = (question) => {
if (askingData.value.question) { if (askingData.value.question) {
data.value.push(askingData.value) data.value.push(askingData.value)
} }
askingData.value = { question, desLoading: true } askingData.value = { question, desLoading: true, collapse: true }
nextTick(() => {
askingData.value.collapse = true
})
} }
const handleContinueAsk = (question) => { const handleContinueAsk = (question) => {
if (asking.value) return if (asking.value) return
...@@ -220,7 +211,7 @@ const handleFormFetchData = (fetchData) => { ...@@ -220,7 +211,7 @@ const handleFormFetchData = (fetchData) => {
handleStopGenerate() handleStopGenerate()
} }
if (meta.type === 'answer') { if (meta.type === 'answer') {
Object.assign(askingData.value, { ansLoading: true, desLoading: false, searchLoading: false, article: message.choices[0].message.content }) Object.assign(askingData.value, { ansLoading: true, desLoading: false, searchLoading: false, article: message.choices[0].message.content, collapse: false })
return return
} }
if (meta.type !== 'log') return if (meta.type !== 'log') return
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册