booleanProp
Stability:
experimental
⚠️ Experimental feature, use at your riskConvert <Comp checked />
to <Comp :checked="true" />
.
Convert <Comp !checked />
to <Comp :checked="false" />
.
Features | Supported |
---|---|
Vue 3 | ✅ |
Nuxt 3 | ✅ |
Vue 2 | ❌ |
Volar Plugin | ✅ |
Options
ts
interface Options { /** * @default '!' */ negativePrefix?: string }
Usage
vue
<script setup> import Comp from './Comp.vue' </script> <template> <Comp checked !enabled /> </template>
vue
<script setup lang="ts"> // Comp.vue defineProps<{ checked: true enabled: false }>() </script>
Volar Configuration
jsonc
{ "vueCompilerOptions": { "plugins": ["unplugin-vue-macros/volar"], "vueMacros": { "booleanProp": true, }, }, }