mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
fix: 修复Search组件无法默认值
This commit is contained in:
parent
dfb24dda81
commit
33fbe43ff6
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ruoyi-vue-pro-vue3",
|
"name": "ruoyi-vue-pro-vue3",
|
||||||
"version": "1.6.4.1851",
|
"version": "1.6.4.1861",
|
||||||
"description": "基于vue3、vite3、element-plus、typesScript",
|
"description": "基于vue3、vite3、element-plus、typesScript",
|
||||||
"author": "xingyu",
|
"author": "xingyu",
|
||||||
"private": false,
|
"private": false,
|
||||||
|
@ -33,7 +33,11 @@ const props = defineProps({
|
|||||||
expand: propTypes.bool.def(false),
|
expand: propTypes.bool.def(false),
|
||||||
// 伸缩的界限字段
|
// 伸缩的界限字段
|
||||||
expandField: propTypes.string.def(''),
|
expandField: propTypes.string.def(''),
|
||||||
inline: propTypes.bool.def(true)
|
inline: propTypes.bool.def(true),
|
||||||
|
model: {
|
||||||
|
type: Object as PropType<Recordable>,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['search', 'reset'])
|
const emit = defineEmits(['search', 'reset'])
|
||||||
@ -62,7 +66,9 @@ const newSchema = computed(() => {
|
|||||||
return schema
|
return schema
|
||||||
})
|
})
|
||||||
|
|
||||||
const { register, elFormRef, methods } = useForm()
|
const { register, elFormRef, methods } = useForm({
|
||||||
|
model: props.model || {}
|
||||||
|
})
|
||||||
|
|
||||||
const search = async () => {
|
const search = async () => {
|
||||||
await unref(elFormRef)?.validate(async (isValid) => {
|
await unref(elFormRef)?.validate(async (isValid) => {
|
||||||
|
@ -41,6 +41,9 @@ export const useForm = (props?: FormProps) => {
|
|||||||
setProps: async (props: FormProps = {}) => {
|
setProps: async (props: FormProps = {}) => {
|
||||||
const form = await getForm()
|
const form = await getForm()
|
||||||
form?.setProps(props)
|
form?.setProps(props)
|
||||||
|
if (props.model) {
|
||||||
|
form?.setValues(props.model)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setValues: async (data: Recordable) => {
|
setValues: async (data: Recordable) => {
|
||||||
|
@ -18,6 +18,8 @@ interface UseTableConfig<T = any> {
|
|||||||
exportListApi?: (option: any) => Promise<T>
|
exportListApi?: (option: any) => Promise<T>
|
||||||
// 返回数据格式配置
|
// 返回数据格式配置
|
||||||
response?: ResponseType
|
response?: ResponseType
|
||||||
|
// 默认传递的参数
|
||||||
|
defaultParams?: Recordable
|
||||||
props?: TableProps
|
props?: TableProps
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +45,9 @@ export const useTable = <T = any>(config?: UseTableConfig<T>) => {
|
|||||||
// 表格数据
|
// 表格数据
|
||||||
tableList: [],
|
tableList: [],
|
||||||
// AxiosConfig 配置
|
// AxiosConfig 配置
|
||||||
params: {},
|
params: {
|
||||||
|
...(config?.defaultParams || {})
|
||||||
|
},
|
||||||
// 加载中
|
// 加载中
|
||||||
loading: true,
|
loading: true,
|
||||||
// 导出加载中
|
// 导出加载中
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
:print-config="{}"
|
:print-config="{}"
|
||||||
:export-config="{}"
|
:export-config="{}"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
class="xtable"
|
|
||||||
>
|
>
|
||||||
<vxe-column title="菜单名称" field="name" width="200" tree-node>
|
<vxe-column title="菜单名称" field="name" width="200" tree-node>
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
|
Loading…
Reference in New Issue
Block a user