shortBind
Stability:
stable
A shorthand for binding prop with the same data name.
:value
-> :value="value"
Features | Supported |
---|---|
Vue 3 | ✅ |
Nuxt 3 | ✅ |
Vue 2 | ❌ |
Volar Plugin | ✅ |
Usage
Basic Usage
vue
<template>
<input :msg />
<!-- => <input :msg="msg" /> -->
<demo $msg />
<!-- => <input $msg="msg" /> -->
</template>
With shortVmodel
vue
<template>
<input ::msg />
<!-- => <input ::msg="msg" /> => <input v-model:msg="msg" /> -->
<demo $msg />
<!-- => <input $msg="msg" /> => <input v-model:msg="msg" /> -->
<demo *msg />
<!-- => <input *msg="msg" /> => <input v-model:msg="msg" /> -->
</template>
Volar Configuration
jsonc
// tsconfig.json
{
"vueCompilerOptions": {
"plugins": [
"@vue-macros/volar/short-bind",
// ...
],
},
}
ESLint Configuration
jsonc
// .eslintrc
{
"rules": {
"vue/valid-v-bind": "off",
},
}