I'm trying to make a text-mask GitHub repository work with my laravel project, With this, I want to use a certain addon which allows me to mask an input field as a price. The GitHub repository I'm talking about is linked here
The addon is called createNumberMask and on their github page it says the following in their documentation:
import createNumberMask from 'text-mask-addons/dist/createNumberMask'
// First, you need to create the `numberMask` with your desired configurations
const numberMask = createNumberMask({
prefix: '',
suffix: ' $' // This will put the dollar sign at the end, with a space.
})
// ...then pass `numberMask` to the Text Mask component as the mask
Now when I try to implement this into my own project it gives me the error saying that the import cannot be found. What is causing this?
I have a blade file which has script tags at the bottom of it. The blade file looks like this,
@section('content')
<div class="row " style="color: white; width: 100%; margin: 0;" id="showEffect">
<div class="col-md-12 text-center" style="margin-top: 10rem">
<div class="row justify-content-md-center">
<div class="col-md-2">
<input type="text" class="myInput form-control depth-5">
</div>
</div>
</div>
</div>
<script type="module">
import createNumberMask from '/node_modules/text-mask-addons/dist/createNumberMask'
const numberMask = createNumberMask({
prefix: '€',
suffix: '',
allowDecimal: true,
});
var myInput = document.querySelector('myInput');
var maskedInputController = vanillaTextMask.maskInput({
inputElement: document.querySelector('myInput'),
mask: numberMask
});
</script>
@endsection
Why is the import not working? The js file is inside the node_modules folder.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2FGAMQ1
via IFTTT
Aucun commentaire:
Enregistrer un commentaire