-
Notifications
You must be signed in to change notification settings - Fork 27
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
How to use v-money3 with <el-input /> (ElementUI)? #74
Comments
What is the version of the Element project that you are using? Element UI was made for Vue2. Element Plus was made for Vue3, same as v-money3. I did not test it, but v-money3 should work fine with Element Plus. |
I use element UI plus Vue 3.0 with v-money3. But it doesn't let me use the v-money3="" directive in the tag. I get this error from (reading 'length'). Does it only work with < input />? |
Oh, now I see! You are using the directive on the I will suggest you to use the
You can add the inner class to apply the styles. I think is |
Same problem with Nuxt UI. I opened a issue on Nuxt UI repository, but the case seems the same as this issue as well. Nuxt UI + v-money3 problem reproduction I seems to the directive is binding directly with the input wrapper and did no finding the input it self. @jonathanpmartins could you please take a look? I'd love to see it working |
I just tested this with element plus. This input styling: <el-input v-model="form.model"/> Is equal to this one: <div class="el-input">
<div class="el-input__wrapper">
<money-3-component
v-model="form.model"
v-bind="{}"
class="el-input__inner"
/>
</div>
</div> I would suggest to create a custom <script setup>
import { Money3Component } from "v-money3";
const props = defineProps({
config: {
type: Object,
default: {
decimal: ',',
thousands: '.',
prefix: 'R$ ',
suffix: '',
precision: 2,
min: Number.MIN_SAFE_INTEGER,
max: Number.MAX_SAFE_INTEGER,
},
},
});
const model = defineModel()
</script>
<template>
<div class="el-input right">
<div class="el-input__wrapper">
<Money3Component
v-model="model"
v-bind="props.config"
class="el-input__inner"
style="text-align: right"
/>
</div>
</div>
</template>
|
@hamonCordova I never ever touch any Nuxt stuff and I don't have any project to test what is going on right now. This project is primarily focused on Vue. If you spend the time and create a repository pointing the problem out, I would love to take a look at it and spend a time to perhaps solve the problem with v-money3. |
Hi, I'm migration my project to vue3 and pinia etc... but don't working v-money3 with my template ElementUI. My old project where I used v-money only, is working. Exemple for error:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
at B (v-money3.mjs:204:19)
at updated (v-money3.mjs:239:95)
at callWithErrorHandling (runtime-core.esm-bundler.js:157:22)
at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:166:21)
at invokeDirectiveHook (runtime-core.esm-bundler.js:2819:13)
at Array. (runtime-core.esm-bundler.js:5380:25)
at flushPostFlushCbs (runtime-core.esm-bundler.js:343:32)
at flushJobs (runtime-core.esm-bundler.js:397:9)
at flushJobs (runtime-core.esm-bundler.js:403:13)
line of code:
<script setup lang="ts"> const maskMoneyParam = reactive({decimal: ',', thousands: '.', prefix: 'R$ ', suffix: '', precision: 2, masked: false }) Main.ts import { Money3Directive } from 'v-money3' const app = createApp(App) app.directive('money3', Money3Directive)The text was updated successfully, but these errors were encountered: