Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error when used as a directive in a Nuxt UI component #100

Open
grosenberg opened this issue Jan 14, 2025 · 1 comment
Open

Type error when used as a directive in a Nuxt UI component #100

grosenberg opened this issue Jan 14, 2025 · 1 comment

Comments

@grosenberg
Copy link

grosenberg commented Jan 14, 2025

Getting an error on line 30 of directive.ts

let positionFromEnd = el.value.length - (el.selectionEnd || 0);

The use (Nuxt UI components) is

 <UFormField
          label="Total Minimum Payment"
          name="minAmt">
          <UInput
            v-model="formState.minAmt"
            v-money3="config"
            placeholder="$ 0.00"
            icon="i-heroicons-currency-dollar" />
   .....

  const formState = ref({
    dueDate: new Date(), // current invoice due date
    invDue: false, // has outstanding balance
    minAmt: '50.00', // minimun amount due
    invAmt: '432.75', // current invoide amount
    curAmt: '736.12', // current total outstanding
  });

  const config = {
    prefix: '$ ',
    suffix: '',
    thousands: ',',
    decimal: '.',
    precision: 2,
    disableNegative: false,
    allowBlank: true,
    minimumNumberOfCharacters: 0,
    lazy: true,
  };

The specific error in the DevTools console is

v-money3.js?v=6a1a9f08:209 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
    at R (v-money3.js?v=6a1a9f08:209:19)
    at updated (v-money3.js?v=6a1a9f08:255:95)
    at callWithErrorHandling (runtime-core.esm-bun…s?v=6a1a9f08:197:19)
    at callWithAsyncErrorHandling (runtime-core.esm-bun…s?v=6a1a9f08:204:17)
    at invokeDirectiveHook (runtime-core.esm-bun…js?v=6a1a9f08:763:7)
    at runtime-core.esm-bun…?v=6a1a9f08:5054:17
    at flushPostFlushCbs (runtime-core.esm-bun…s?v=6a1a9f08:382:28)
    at flushJobs (runtime-core.esm-bun…js?v=6a1a9f08:424:5)
    at flushJobs (runtime-core.esm-bun…js?v=6a1a9f08:427:7)

Any help will be appreciated.

@luizpbello
Copy link

i'm with this same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants