mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-27 02:52:48 +00:00
feat: 对话增加历史记录
This commit is contained in:
parent
5de78cf446
commit
e8f1bd9991
|
|
@ -4,7 +4,7 @@
|
|||
<template v-for="(item, index) in data" :key="index">
|
||||
<li
|
||||
@click.prevent="clickHandle(item, index)"
|
||||
:class="current === index ? 'active' : ''"
|
||||
:class="current === item[props.valueKey] ? 'active' : ''"
|
||||
class="cursor"
|
||||
>
|
||||
<slot :row="item" :index="index"> </slot>
|
||||
|
|
@ -23,10 +23,12 @@ const props = withDefaults(
|
|||
defineProps<{
|
||||
data: Array<any>
|
||||
defaultActive?: string
|
||||
valueKey?: string // 唯一标识的键名
|
||||
}>(),
|
||||
{
|
||||
data: () => [],
|
||||
defaultActive: ''
|
||||
defaultActive: '',
|
||||
valueKey: 'id'
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -35,9 +37,7 @@ const current = ref<Number | String>(0)
|
|||
watch(
|
||||
() => props.defaultActive,
|
||||
(val) => {
|
||||
if (val) {
|
||||
current.value = props.data.findIndex((v) => v.id === val)
|
||||
}
|
||||
current.value = val
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
|
@ -45,7 +45,7 @@ watch(
|
|||
const emit = defineEmits(['click'])
|
||||
|
||||
function clickHandle(row: any, index: number) {
|
||||
current.value = index
|
||||
current.value = row[props.valueKey]
|
||||
emit('click', row)
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -141,7 +141,6 @@ const clickListHandle = (item: any) => {
|
|||
}
|
||||
|
||||
function refresh(id: string) {
|
||||
console.log(id)
|
||||
getChatLog(applicationDetail.value.id)
|
||||
currentChatId.value = id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,13 @@
|
|||
<div class="template-manage flex main-calc-height">
|
||||
<div class="template-manage__left p-8 border-r">
|
||||
<h4 class="p-16" style="padding-bottom: 8px">供应商</h4>
|
||||
<common-list :data="provider_list" v-loading="loading" @click="clickListHandle">
|
||||
<common-list
|
||||
:data="provider_list"
|
||||
v-loading="loading"
|
||||
@click="clickListHandle"
|
||||
value-key="provider"
|
||||
default-active=""
|
||||
>
|
||||
<template #default="{ row, index }">
|
||||
<div class="flex" v-if="index === 0">
|
||||
<AppIcon
|
||||
|
|
|
|||
Loading…
Reference in New Issue