未验证 提交 ab62739f 编写于 作者: 1 1sm 提交者: GitHub

`ApiSelect` Add `alwaysLoad` option (#1461)

* fix(modal): 取消全屏功能后关闭图标颜色异常

* chore: move to pnpm

* fix: RangePicekr在表单项中占满分配的宽度

* chore: comment format

* Revert "fix: RangePicekr在表单项中占满分配的宽度"

This reverts commit cd70e41dac294329383be3d2f0a393dc26b7f140.

* feat(ApiSelect): 新增每次加载选项
Co-authored-by: Nliushiman <smliu@gk-estor.com>
上级 b70fade5
<template> <template>
<Select <Select
@dropdownVisibleChange="handleFetch" @dropdown-visible-change="handleFetch"
v-bind="$attrs" v-bind="$attrs"
@change="handleChange" @change="handleChange"
:options="getOptions" :options="getOptions"
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
labelField: propTypes.string.def('label'), labelField: propTypes.string.def('label'),
valueField: propTypes.string.def('value'), valueField: propTypes.string.def('value'),
immediate: propTypes.bool.def(true), immediate: propTypes.bool.def(true),
alwaysLoad: propTypes.bool.def(false),
}, },
emits: ['options-change', 'change'], emits: ['options-change', 'change'],
setup(props, { emit }) { setup(props, { emit }) {
...@@ -87,7 +88,7 @@ ...@@ -87,7 +88,7 @@
}); });
watchEffect(() => { watchEffect(() => {
props.immediate && fetch(); props.immediate && !props.alwaysLoad && fetch();
}); });
watch( watch(
...@@ -121,10 +122,14 @@ ...@@ -121,10 +122,14 @@
} }
} }
async function handleFetch() { async function handleFetch(visible) {
if (!props.immediate && unref(isFirstLoad)) { if (visible) {
await fetch(); if (props.alwaysLoad) {
isFirstLoad.value = false; await fetch();
} else if (!props.immediate && unref(isFirstLoad)) {
await fetch();
isFirstLoad.value = false;
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册