@tmagic/form 1.2.4 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3314,25 +3314,36 @@
3314
3314
  }
3315
3315
  });
3316
3316
  }
3317
- props.config.remote && vue.onMounted(async () => {
3318
- await vue.nextTick();
3319
- tMagicSelect.value?.scrollbarWrap?.addEventListener("scroll", async (e) => {
3320
- const el = e.currentTarget;
3321
- if (moreLoadingVisible.value) {
3322
- return;
3323
- }
3324
- if (el.scrollHeight - el.clientHeight - el.scrollTop > 1) {
3325
- return;
3326
- }
3327
- if (total.value <= options.value.length) {
3328
- return;
3317
+ if (props.config.remote) {
3318
+ const unWacth = vue.watch(
3319
+ () => tMagicSelect.value?.scrollbarWrap,
3320
+ (scrollbarWrap) => {
3321
+ if (!scrollbarWrap) {
3322
+ return;
3323
+ }
3324
+ scrollbarWrap.addEventListener("scroll", async (e) => {
3325
+ const el = e.currentTarget;
3326
+ if (moreLoadingVisible.value) {
3327
+ return;
3328
+ }
3329
+ if (el.scrollHeight - el.clientHeight - el.scrollTop > 1) {
3330
+ return;
3331
+ }
3332
+ if (total.value <= options.value.length) {
3333
+ return;
3334
+ }
3335
+ moreLoadingVisible.value = true;
3336
+ pgIndex.value += 1;
3337
+ options.value = await getOptions();
3338
+ moreLoadingVisible.value = false;
3339
+ });
3340
+ unWacth();
3341
+ },
3342
+ {
3343
+ immediate: true
3329
3344
  }
3330
- moreLoadingVisible.value = true;
3331
- pgIndex.value += 1;
3332
- options.value = await getOptions();
3333
- moreLoadingVisible.value = false;
3334
- });
3335
- });
3345
+ );
3346
+ }
3336
3347
  const popperClass = mForm?.popperClass;
3337
3348
  const changeHandler = (value) => {
3338
3349
  emit("change", value);