KRightToolbar 右侧工具栏
表格右上角的三个圆形按钮:搜索显隐、刷新、显示/隐藏列。比 KTableHeader 轻量,适合 RuoYi 风格的列表页。
基础用法
columns 传 [{ key, label, visible }];点击树节点会原地更新 visible。
showSearch: true · 点最右侧按钮可勾选显示列
[
{
"key": "name",
"label": "应用名称",
"visible": true
},
{
"key": "code",
"label": "编码",
"visible": true
},
{
"key": "version",
"label": "版本",
"visible": false
}
]docs/examples/right-toolbar/basic.vue
vue
<script setup lang="ts">
import { ref } from 'vue';
import { KRightToolbar } from '@wujies/components';
const showSearch = ref(true);
const columns = ref([
{ key: 'name', label: '应用名称', visible: true },
{ key: 'code', label: '编码', visible: true },
{ key: 'version', label: '版本', visible: false }
]);
const message = ref('');
</script>
<template>
<div>
<KRightToolbar v-model:show-search="showSearch" :columns="columns" @query-table="message = '已触发刷新'" />
<p style="font-size: 13px; color: var(--el-text-color-secondary)">
showSearch: {{ showSearch }} · {{ message || '点最右侧按钮可勾选显示列' }}
</p>
<pre style="font-size: 12px; background: var(--el-fill-color-light); padding: 12px; border-radius: 6px">{{ columns }}</pre>
</div>
</template>
API
Attributes
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| showSearch | 当前是否显示搜索区,支持 v-model:showSearch | boolean | true |
| search | 是否显示搜索按钮 | boolean | true |
| columns | 列配置(有值时显示列按钮) | FieldOption[] | undefined |
| gutter | 右侧外边距(px) | number | 10 |
Events
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| update:showSearch | 搜索显隐切换 | boolean |
| queryTable | 点击刷新 | — |