I am trying to use Vanilla JS Datepicker in a Vue3 project but unsure how to correctly set it up. As per the docs (which I realise don't specifically relate to Vue) I have installed the package:
npm install --save-dev vanillajs-datepicker
In the template:
<input type="text" name="foo" />
The script:
import { Datepicker } from "vanillajs-datepicker";
mounted() {
const elem = document.getElementById("foo");
const datepicker = new Datepicker(elem, {
// ...options
});
},
I am getting the error:
error 'datepicker' is assigned a value but never used
UPDATE
<input type="text" ref="foo" />
new Datepicker(this.$refs.foo, {
// ...options
});
And all is working.