提交 7083fa8b 编写于 作者: D DebugIsFalse

add fetch

上级 2de6467c
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
</div> </div>
</template> </template>
<script setup> <script setup>
const { $setRepo } = useReposStore()
const { fetchRequest } = useFetchRequest() const { fetchRequest } = useFetchRequest()
const emits = defineEmits([ 'search' ]) const emits = defineEmits([ 'search' ])
const query = ref('') const query = ref('')
...@@ -67,6 +68,7 @@ repos.value = repoData.data.map(item => { ...@@ -67,6 +68,7 @@ repos.value = repoData.data.map(item => {
branch: item.branch branch: item.branch
} }
}) })
$setRepo(repos.value)
defineShortcuts({ defineShortcuts({
meta_enter: { meta_enter: {
......
...@@ -62,12 +62,11 @@ const isAutoToBottom = ref(true) ...@@ -62,12 +62,11 @@ const isAutoToBottom = ref(true)
const handleScroll = (event, params) => { const handleScroll = (event, params) => {
// 在asking操作的时候生效 // 在asking操作的时候生效
if (!asking.value || !isAutoToBottom.value) return if (!asking.value || !isAutoToBottom.value) return
nextTick(() => { const top = window.scrollY;
const top = window.scrollY; console.log('y.value:', top, y.value)
if (top < y.value) { if (top < y.value) {
isAutoToBottom.value = false isAutoToBottom.value = false
} }
})
} }
const scrollToView = () => { const scrollToView = () => {
if (!isAutoToBottom.value) return if (!isAutoToBottom.value) return
...@@ -133,7 +132,7 @@ const handleFormFetchData = (fetchData) => { ...@@ -133,7 +132,7 @@ const handleFormFetchData = (fetchData) => {
if (Object.keys(message).length === 0) return if (Object.keys(message).length === 0) return
const { meta, choices } = message const { meta, choices } = message
const index = editIndex.value const index = editIndex.value
nextTick(() => { setTimeout(() => {
scrollToView() scrollToView()
}) })
// 处理报错信息 // 处理报错信息
......
import { defineStore } from 'pinia'
export const useReposStore = defineStore('repos', () => {
const $repos = ref([])
function $setRepo (data) {
$repos.value = data || []
}
return { $repos, $setRepo }
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册