在vue-imask中,如何获得iMask类?

发布于 2025-01-30 11:44:01 字数 989 浏览 0 评论 0 原文

我的问题与Angular非常相似: Angular-imask我如何获得iMask类? 我对VUE组成api https://github.com/unmanner/imaskjs/tree/master/packages/vue-imask-mask-mask-mask-mask-composable-vue-3 可以拨打 mask.updatevalue()代码>为了使其与Veevalidate一起使用(ex:)。

这是我从控制台收到的消息:

元素值在蒙版之外更改。使用 mask.updatevalue()同步掩码才能正常工作。

我尝试像 const {mask} = useimask(formatterMask)那样检索iMask类,但它不是不幸的imask类。

有什么想法如何进行? 谢谢。

My question is very similar to this one for angular: In angular-imask how do I get the IMask class?
I'm especially interested about the Vue Composition API https://github.com/uNmAnNeR/imaskjs/tree/master/packages/vue-imask#mask-composable-vue-3 to be able to call mask.updateValue() in order to make it work with VeeValidate (ex: https://vee-validate.logaretm.com/v4/examples/value-formatting).

Here is the message I get from the console:

Element value was changed outside of mask. Syncronize mask using mask.updateValue() to work properly.

I've tried to retrieve the IMask class like that const { mask } = useIMask(formatterMask) but it is not the IMask class unfortunatly.

Any idea how to proceed?
Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

山田美奈子 2025-02-06 11:44:01

imask 实例确实是存储在 mask 中从 useimask()返回。因为掩码 /a>,您需要通过其 .value 属性来解开它:

const { mask } = useIMask(formatterMask)

console.log(mask.value) // => IMask instance

The IMask instance is indeed stored in mask returned from useIMask(). Since mask is a ref, you need to unwrap it via its .value property:

const { mask } = useIMask(formatterMask)

console.log(mask.value) // => IMask instance
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文