ExprEval
| Category | Expression |
| Dependencies | expr-eval-fork |
| Bundle size | 2.84 kB (10.50 kB with 3rd party deps) |
Expression evaluator used by Vueform for conditions and computed values.
Installation
bash
npm install @vueform/expr-evalbash
pnpm add @vueform/expr-evalbash
yarn add @vueform/expr-evalbash
bun add @vueform/expr-evalts
import { createVueform } from '@vueform/ui'
import exprEval from '@vueform/expr-eval'
createVueform({
plugins: [exprEval()],
})Usage
Registering the plugin replaces the default expression engine with a full evaluator. Bare path interpolation like {name} works without any plugin — everything beyond it, operators, comparisons, ternaries, and function calls, needs this engine:
ts
import { defineSchema } from '@vueform/ui'
const schema = defineSchema({
price: { type: 'text', label: 'Price', default: 100 },
quantity: { type: 'text', label: 'Quantity', default: 3 },
total: {
type: 'text',
label: 'Total',
default: '{price * quantity}',
},
})The expression language and everything built on it — syntax and operators, built-in and custom functions, computed values, wildcards in lists, conditions, constants, escaping — is documented in the Expressions guide, and the $expression options in the Configuration chapter.