我需要用于金钱输入和电话号码输入的输入掩码。
我尝试了这个vue包,但无法安装到nuxt3
https://github.com/autoNumeric/vue-autoNumeric/tree/master
我在我的plugins/moneyMask.js文件中定义了nuxt3插件
import {VueAutonumeric} from 'vue-autonumeric/dist/vue-autonumeric.min.js'
export default defineNuxtPlugin((nuxtApp) =\> {
nuxtApp.vueApp.component('VueAutonumeric', VueAutonumeric);
})
并在模板中使用
<VueAutonumeric
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
v-model="contract.monthly_rent"
:options="'commaDecimalCharDotSeparator'"
></VueAutonumeric>
但失败了:
\[Vue warn\]: Failed to resolve component: VueAutonumeric
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.
您找到可行的替代方案了吗?我也有兴趣有这样的东西