I am trying to utilize EyeDropper for an eyedropper function in my project that uses Vue2 + Ts. Here is the code snippet:
<div
v-if="haveEyeDropper"
@click="handleClickPick"
>
<i class="iconfont icon-xiguan"></i>
</div>
handleClickPick(): void {
const eyeDropper = new EyeDropper();
// ...
}
However, I am encountering errors stating "Cannot find name 'EyeDropper'. Did you mean 'eyeDropper'? -Vetur" and "'EyeDropper' is not defined -eslint". Interestingly, when I copied the example code from MDN documentation (https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper) into an index.html
file, it worked without any issues.
(Using Chrome version 105.0.5195.52)