Sorry for creating an issue for this, I couldn't see a questions option.
Is there a way to add custom validation rules?
If I add /plugins/formkit.ts with
import { defaultConfig, plugin } from '@formkit/vue'
import isRange from '~/rules/isRange'
export default defineNuxtPlugin({
parallel: true,
setup: (nuxtApp) => {
nuxtApp.vueApp.use(plugin, defaultConfig({
rules: { isRange },
}))
},
})
and rules/isRange.ts
const isRange = function (node) {
return node.value.length === 2
}
export default isRange
I don't know if this code is correct, but I also get:
WARN: Plugin has already been applied to target app.