create-v-model
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -22,4 +22,7 @@ import { computed } from 'vue'; | ||
const modelProps = ({ modelName = 'modelValue', modelType = null, modifierDefault = emptyObjectFactory } = {}) => ({ | ||
[modelName]: modelType, | ||
const modelProps = ({ modelName = 'modelValue', modelType = null, modelDefault, modifierDefault = emptyObjectFactory } = {}) => ({ | ||
[modelName]: { | ||
type: modelType, | ||
default: modelDefault | ||
}, | ||
[getModifierName(modelName)]: { | ||
@@ -26,0 +29,0 @@ type: Object, |
{ | ||
"name": "create-v-model", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "create v-model bindings quickly and easily - without having to remember which props to use", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -41,3 +41,3 @@ # create-v-model | ||
modelType: any = null, | ||
modifierDefault: any = (() => ({})) // but you probably want an object factory here of some form | ||
modifierDefault: any = (() => ({})) | ||
}) | ||
@@ -47,5 +47,5 @@ } | ||
**modelName**: the name of the model; leave this as the default for plain `v-model`, and otherwise give it the `NAME` in `v-model:NAME` | ||
**modelType**: an optional type to specify the model should be | ||
**modifierDefault**: an optional alternative default for the _modelModifiers_ prop (or equivalent for named models) | ||
- **modelName**: the name of the model; leave this as the default for plain `v-model`, and otherwise give it the `NAME` in `v-model:NAME` | ||
- **modelType**: an optional type to specify the model should be | ||
- **modifierDefault**: an optional alternative default for the _modelModifiers_ prop (or equivalent for named models) | ||
@@ -67,6 +67,6 @@ ### createModel | ||
**props**: the props from setup - this is required | ||
**emit**: if emit is provided, then Vue's built-in modifiers (`trim` and `number`) will be enabled - and events will be emitted for updates instead of directly calling the relevant `onUpdate` function directly | ||
**modelName**: the name of the model; leave this as the default for plain `v-model`, and otherwise give it the `NAME` in `v-model:NAME` | ||
**modifier**: a function of the form below, this will be called whenever the model would call `set` | ||
- **props**: the props from setup - this is required | ||
- **emit**: if emit is provided, then Vue's built-in modifiers (`trim` and `number`) will be enabled - and events will be emitted for updates instead of directly calling the relevant `onUpdate` function directly | ||
- **modelName**: the name of the model; leave this as the default for plain `v-model`, and otherwise give it the `NAME` in `v-model:NAME` | ||
- **modifier**: a function of the form below, this will be called whenever the model would call `set` | ||
- `(value: typeof modelType, modelModifiersObject: object) => typeof modelType` | ||
@@ -73,0 +73,0 @@ |
Sorry, the diff of this file is not supported yet
6884
60