Skip to content

Commit e9e69f7

Browse files
author
fuyoo
committed
can add update function
1 parent 1205396 commit e9e69f7

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

src/pages/host/components/CoKeys/compoents/NewStringForm.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const message = useMessage()
2525
const req = useReqStore()
2626
const submitFn = async () => {
2727
await formRef.value?.validate()
28+
debugger
2829
await req.reqWithHost<boolean>({
2930
path:"/cmd",
3031
data: ['set',form.key,form.data ]

src/pages/host/components/CoKeys/index.vue

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,15 @@ const addFn = (v: RedisKeyType) => {
289289
break
290290
}
291291
}
292+
const refreshFn = (s: boolean) => {
293+
if (s) {
294+
search.tree = []
295+
} else {
296+
original.tree = []
297+
}
298+
console.log('refreshFn',s, original)
299+
queryData(s)
300+
}
292301
</script>
293302
<template>
294303
<div ref="treeBoxRef" class="w-full flex flex-col flex-1 justify-start items-start">
@@ -321,28 +330,40 @@ const addFn = (v: RedisKeyType) => {
321330
virtual-scroll
322331
expand-on-click
323332
:node-props="nodeProps"
324-
:style="{ height: height+'px' }"
333+
:style="{ height: height + 'px' }"
325334
key-field="id"
326335
children-field="children"
327336
class="whitespace-nowrap"
328337
/>
329-
<div
330-
class="flex flex-1 w-full justify-center items-center"
331-
v-if="!search.match"
332-
>
333-
<n-button v-show="original.cursor !== '0'" size="small" type="primary" :loading="reqStore.reqLoading" @click="loadMoreFn"
338+
<div class="flex flex-1 w-full justify-center items-center" v-if="!search.match">
339+
<n-button
340+
v-show="original.cursor !== '0'"
341+
size="small"
342+
type="primary"
343+
:loading="reqStore.reqLoading"
344+
@click="loadMoreFn"
334345
>加载更多
335346
</n-button>
336-
<n-button v-show="original.cursor === '0'" size="small" type="primary">更新数据</n-button>
347+
<n-button
348+
@click="refreshFn(false)"
349+
v-show="original.cursor === '0'"
350+
size="small"
351+
type="primary"
352+
>更新数据
353+
</n-button>
337354
</div>
338-
<div
339-
v-else
340-
class="flex flex-1 w-full justify-center items-center"
341-
>
342-
<n-button v-show="search.cursor !== '0'" size="small" type="primary" :loading="reqStore.reqLoading" @click="loadMoreFn"
355+
<div v-else class="flex flex-1 w-full justify-center items-center">
356+
<n-button
357+
v-show="search.cursor !== '0'"
358+
size="small"
359+
type="primary"
360+
:loading="reqStore.reqLoading"
361+
@click="loadMoreFn"
343362
>加载更多
344363
</n-button>
345-
<n-button v-show="search.cursor === '0'" size="small" type="primary">更新数据</n-button>
364+
<n-button @click="refreshFn(true)" v-show="search.cursor === '0'" size="small" type="primary"
365+
>更新数据</n-button
366+
>
346367
</div>
347368
</div>
348369
<n-dropdown

0 commit comments

Comments
 (0)