refactor(knowledge): 优化知识库相关组件的样式和功能- 修改按钮样式,增加图标并隐藏文字

- 优化表格渲染逻辑,提高组件灵活性
-统一使用 outline 图标风格- 修复搜索框回车事件处理
This commit is contained in:
陈昱达
2025-04-23 16:48:14 +08:00
parent 425cbe7621
commit 72bce3b71b
5 changed files with 59 additions and 61 deletions

View File

@@ -18,8 +18,8 @@ const RenderSlot = {
{ {
props: { props: {
placement: 'bottom-end', placement: 'bottom-end',
content: first[0].data.props.title, content: first[0].data.props.title
effect: 'light' // effect: 'light'
} }
}, },
first first
@@ -76,12 +76,16 @@ const RenderSlot = {
content.children = [renderTooltip(first), renderPopver(other)] content.children = [renderTooltip(first), renderPopver(other)]
return content return content
} else { } else {
const first = contentDiv.splice(0, 1) // const first = contentDiv.splice(0, contentDiv)
first[0].data.class = 'normal-button'
first[0].data.props.type = null
first[0].data.props.size = null
content.children = [renderTooltip(first)]
contentDiv = contentDiv.map(item => {
console.log(item)
item.data.class = 'normal-button'
item.data.props.type = null
item.data.props.size = null
return renderTooltip([item])
})
content.children = contentDiv
return content return content
} }
// let div = // let div =

View File

@@ -112,36 +112,33 @@ export default {
prop: 'knowledgeDesc', prop: 'knowledgeDesc',
width: '150px', width: '150px',
align: 'center', align: 'center',
isRedraw: true,
render: (h, params) => { render: (h, params) => {
return h('span', {}, [ return h('span', {}, [
h( h('el-button', {
'el-button',
{
class: 'floatSpan', class: 'floatSpan',
props: { props: {
type: 'primary', type: 'primary',
size: 'medium' size: 'medium',
title: '修改',
icon: 'el-icon-edit-outline'
}, },
on: { on: {
click: () => this.handleEdit(params.row) click: () => this.handleEdit(params.row)
} }
}, }),
'修改' h('el-button', {
),
h(
'el-button',
{
class: 'floatSpan', class: 'floatSpan',
props: { props: {
type: 'primary', type: 'primary',
size: 'medium' size: 'medium',
title: '预览',
icon: 'el-icon-view'
}, },
on: { on: {
click: () => this.handlePreview(params.row) click: () => this.handlePreview(params.row)
} }
}, })
'预览'
)
]) ])
} }
} }

View File

@@ -118,36 +118,33 @@ export default {
prop: 'knowledgeDesc', prop: 'knowledgeDesc',
width: '150px', width: '150px',
align: 'center', align: 'center',
isRedraw: true,
render: (h, params) => { render: (h, params) => {
return h('span', {}, [ return h('span', {}, [
h( h('el-button', {
'el-button',
{
class: 'floatSpan', class: 'floatSpan',
props: { props: {
type: 'primary', type: 'primary',
size: 'medium' size: 'medium',
title: '修改',
icon: 'el-icon-edit-outline'
}, },
on: { on: {
click: () => this.handleEdit(params.row) click: () => this.handleEdit(params.row)
} }
}, }),
'修改' h('el-button', {
),
h(
'el-button',
{
class: 'floatSpan', class: 'floatSpan',
props: { props: {
type: 'primary', type: 'primary',
size: 'medium' size: 'medium',
title: '预览',
icon: 'el-icon-view'
}, },
on: { on: {
click: () => this.handlePreview(params.row) click: () => this.handlePreview(params.row)
} }
}, })
'预览'
)
]) ])
} }
} }

View File

@@ -390,7 +390,7 @@ export default {
type: 'primary', type: 'primary',
size: 'mini', size: 'mini',
disabled: true, disabled: true,
icon: 'el-icon-edit', icon: 'el-icon-edit-outline',
title: '编辑' title: '编辑'
}, },
on: {} on: {}

View File

@@ -2,7 +2,7 @@
<div id="index-container" class="container index-container"> <div id="index-container" class="container index-container">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-input placeholder="输入知识库名称" clearable v-model="nameLike" size="medium" class="underBorder"> <el-input placeholder="输入知识库名称" clearable v-model="nameLike" size="medium" class="underBorder" @keydown.enter.native="getList">
<template slot="prepend"> <template slot="prepend">
<el-button slot="append" icon="el-icon-search" @click="getList"></el-button> <el-button slot="append" icon="el-icon-search" @click="getList"></el-button>
</template> </template>