booleanProp
稳定性:
稳定
Convert <Comp checked />
to <Comp :checked="true" />
.
Features | Supported |
---|---|
Vue 3 | ✅ |
Nuxt 3 | ✅ |
Vue 2 | ❌ |
Volar Plugin | ✅ |
Setup
Installation
bash
npm i -D @vue-macros/boolean-prop
Vite Integration
ts
// vite.config.ts
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import { transformBooleanProp } from '@vue-macros/boolean-prop'
export default defineConfig({
plugins: [
Vue({
template: {
compilerOptions: {
nodeTransforms: [transformBooleanProp()],
},
},
}),
],
})
Usage
vue
<template>
<Comp checked />
</template>
vue
<script setup lang="ts">
// Comp.vue
defineProps<{
checked?: any
}>()
</script>