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

Merge branch 'main' of gitcode.com:git_bot/ai-fe

......@@ -166,7 +166,19 @@ const state = reactive({
branch: repoItem.branch,
gitPath: repoItem.url
})
// 是否停止自动滚动到底部
const isAutoToBottom = ref(true);
let markedWindowScrollTop = 0;
const handleScroll = () => {
const top = window.scrollY;
if (top < markedWindowScrollTop) {
isAutoToBottom.value = false;
} else {
markedWindowScrollTop = top
}
}
const scrollToView = () => {
if (!isAutoToBottom.value) return;
const $target = document.querySelector('#scrollElement')
const height = $target.clientHeight
y.value = height;
......@@ -216,7 +228,7 @@ defineShortcuts({
enter: {
usingInput: 'queryInput',
handler: () => {
handleContinueAsk(continueQuestion)
handleContinueAsk(continueQuestion.value)
}
}
})
......@@ -226,6 +238,7 @@ const handleClearInput = () => {
}
const handleContinueAsk = (question) => {
if (asking.value) return
isAutoToBottom.value = true
asking.value = true
editIndex.value = data.value.length
createGenerateInitItem(question)
......@@ -366,6 +379,10 @@ const generateFetchData = (query) => {
}
onMounted(() => {
generateFetchData(state.query)
window.addEventListener('scroll', handleScroll)
})
onBeforeUnmount(()=> {
window.removeEventListener('scroll', handleScroll);
})
</script>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册