mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-23 09:40:25 +08:00
Merge branch 'main' into rounded
This commit is contained in:
commit
9bb9eee822
@ -129,7 +129,8 @@ function fetchApi(): Promise<Record<string, any>> {
|
|||||||
|
|
||||||
| 属性名 | 描述 | 类型 | 默认值 |
|
| 属性名 | 描述 | 类型 | 默认值 |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| component | 欲包装的组件 | `Component` | - |
|
| modelValue(v-model) | 当前值 | `any` | - |
|
||||||
|
| component | 欲包装的组件(以下称为目标组件) | `Component` | - |
|
||||||
| numberToString | 是否将value从数字转为string | `boolean` | `false` |
|
| numberToString | 是否将value从数字转为string | `boolean` | `false` |
|
||||||
| api | 获取数据的函数 | `(arg?: any) => Promise<OptionsItem[] \| Record<string, any>>` | - |
|
| api | 获取数据的函数 | `(arg?: any) => Promise<OptionsItem[] \| Record<string, any>>` | - |
|
||||||
| params | 传递给api的参数 | `Record<string, any>` | - |
|
| params | 传递给api的参数 | `Record<string, any>` | - |
|
||||||
@ -137,16 +138,12 @@ function fetchApi(): Promise<Record<string, any>> {
|
|||||||
| labelField | label字段名 | `string` | `label` |
|
| labelField | label字段名 | `string` | `label` |
|
||||||
| childrenField | 子级数据字段名,需要层级数据的组件可用 | `string` | `` |
|
| childrenField | 子级数据字段名,需要层级数据的组件可用 | `string` | `` |
|
||||||
| valueField | value字段名 | `string` | `value` |
|
| valueField | value字段名 | `string` | `value` |
|
||||||
| optionsPropName | 组件接收options数据的属性名称 | `string` | `options` |
|
| optionsPropName | 目标组件接收options数据的属性名称 | `string` | `options` |
|
||||||
| modelPropName | 组件的双向绑定属性名,默认为modelValue。部分组件可能为value | `string` | `modelValue` |
|
| modelPropName | 目标组件的双向绑定属性名,默认为modelValue。部分组件可能为value | `string` | `modelValue` |
|
||||||
| immediate | 是否立即调用api | `boolean` | `true` |
|
| immediate | 是否立即调用api | `boolean` | `true` |
|
||||||
| alwaysLoad | 每次`visibleEvent`事件发生时都重新请求数据 | `boolean` | `false` |
|
| alwaysLoad | 每次`visibleEvent`事件发生时都重新请求数据 | `boolean` | `false` |
|
||||||
| beforeFetch | 在api请求之前的回调函数 | `AnyPromiseFunction<any, any>` | - |
|
| beforeFetch | 在api请求之前的回调函数 | `AnyPromiseFunction<any, any>` | - |
|
||||||
| afterFetch | 在api请求之后的回调函数 | `AnyPromiseFunction<any, any>` | - |
|
| afterFetch | 在api请求之后的回调函数 | `AnyPromiseFunction<any, any>` | - |
|
||||||
| options | 直接传入选项数据,也作为api返回空数据时的后备数据 | `OptionsItem[]` | - |
|
| options | 直接传入选项数据,也作为api返回空数据时的后备数据 | `OptionsItem[]` | - |
|
||||||
| visibleEvent | 触发重新请求数据的事件名 | `string` | - |
|
| visibleEvent | 触发重新请求数据的事件名 | `string` | - |
|
||||||
| loadingSlot | 组件的插槽名称,用来显示一个"加载中"的图标 | `string` | - |
|
| loadingSlot | 目标组件的插槽名称,用来显示一个"加载中"的图标 | `string` | - |
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
|
@ -127,7 +127,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
|
|
||||||
| 事件名 | 描述 | 类型 | 版本号 |
|
| 事件名 | 描述 | 类型 | 版本号 |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| onBeforeClose | 关闭前触发,返回 `false`或者被`reject`则禁止关闭 | `()=>Promise<boolean>\|boolean` | |
|
| onBeforeClose | 关闭前触发,返回 `false`或者被`reject`则禁止关闭 | `()=>Promise<boolean>\|boolean` | >5.5.2支持Promise |
|
||||||
| onCancel | 点击取消按钮触发 | `()=>void` | |
|
| onCancel | 点击取消按钮触发 | `()=>void` | |
|
||||||
| onClosed | 关闭动画播放完毕时触发 | `()=>void` | >5.4.3 |
|
| onClosed | 关闭动画播放完毕时触发 | `()=>void` | >5.4.3 |
|
||||||
| onConfirm | 点击确认按钮触发 | `()=>void` | |
|
| onConfirm | 点击确认按钮触发 | `()=>void` | |
|
||||||
@ -146,15 +146,15 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
|
|
||||||
### modalApi
|
### modalApi
|
||||||
|
|
||||||
| 方法 | 描述 | 类型 |
|
| 方法 | 描述 | 类型 | 版本 |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| setState | 动态设置弹窗状态属性 | `(((prev: ModalState) => Partial<ModalState>)\| Partial<ModalState>)=>modalApi` |
|
| setState | 动态设置弹窗状态属性 | `(((prev: ModalState) => Partial<ModalState>)\| Partial<ModalState>)=>modalApi` | - |
|
||||||
| open | 打开弹窗 | `()=>void` |
|
| open | 打开弹窗 | `()=>void` | - |
|
||||||
| close | 关闭弹窗 | `()=>void` |
|
| close | 关闭弹窗 | `()=>void` | - |
|
||||||
| setData | 设置共享数据 | `<T>(data:T)=>modalApi` |
|
| setData | 设置共享数据 | `<T>(data:T)=>modalApi` | - |
|
||||||
| getData | 获取共享数据 | `<T>()=>T` |
|
| getData | 获取共享数据 | `<T>()=>T` | - |
|
||||||
| useStore | 获取可响应式状态 | - |
|
| useStore | 获取可响应式状态 | - | - |
|
||||||
| lock | 将弹窗标记为提交中,锁定当前状态 | `(isLock:boolean)=>modalApi` |
|
| lock | 将弹窗标记为提交中,锁定当前状态 | `(isLock:boolean)=>modalApi` | >5.5.2 |
|
||||||
|
|
||||||
::: info lock
|
::: info lock
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ const getAppendTo = computed(() => {
|
|||||||
ref="wrapperRef"
|
ref="wrapperRef"
|
||||||
:class="
|
:class="
|
||||||
cn('relative min-h-40 flex-1 overflow-y-auto p-3', contentClass, {
|
cn('relative min-h-40 flex-1 overflow-y-auto p-3', contentClass, {
|
||||||
'pointer-events-none overflow-hidden': showLoading || submitting,
|
'overflow-hidden': showLoading || submitting,
|
||||||
})
|
})
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -121,7 +121,7 @@ const bindProps = computed(() => {
|
|||||||
[`onUpdate:${props.modelPropName}`]: (val: string) => {
|
[`onUpdate:${props.modelPropName}`]: (val: string) => {
|
||||||
modelValue.value = val;
|
modelValue.value = val;
|
||||||
},
|
},
|
||||||
...objectOmit(attrs, ['onUpdate:value']),
|
...objectOmit(attrs, [`onUpdate:${props.modelPropName}`]),
|
||||||
...(props.visibleEvent
|
...(props.visibleEvent
|
||||||
? {
|
? {
|
||||||
[props.visibleEvent]: handleFetchForVisible,
|
[props.visibleEvent]: handleFetchForVisible,
|
||||||
@ -191,18 +191,16 @@ function emitChange() {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-bind="{ ...$attrs }">
|
<component
|
||||||
<component
|
:is="component"
|
||||||
:is="component"
|
v-bind="bindProps"
|
||||||
v-bind="bindProps"
|
:placeholder="$attrs.placeholder"
|
||||||
:placeholder="$attrs.placeholder"
|
>
|
||||||
>
|
<template v-for="item in Object.keys($slots)" #[item]="data">
|
||||||
<template v-for="item in Object.keys($slots)" #[item]="data">
|
<slot :name="item" v-bind="data || {}"></slot>
|
||||||
<slot :name="item" v-bind="data || {}"></slot>
|
</template>
|
||||||
</template>
|
<template v-if="loadingSlot && loading" #[loadingSlot]>
|
||||||
<template v-if="loadingSlot && loading" #[loadingSlot]>
|
<LoaderCircle class="animate-spin" />
|
||||||
<LoaderCircle class="animate-spin" />
|
</template>
|
||||||
</template>
|
</component>
|
||||||
</component>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user