-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat(b-form-input, b-form-textarea): add lazy
modifier prop to update v-model on change/blur event
#4169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…pdate v-model on change event
Codecov Report
@@ Coverage Diff @@
## dev #4169 +/- ##
==========================================
+ Coverage 99.86% 99.91% +0.04%
==========================================
Files 237 237
Lines 4544 4548 +4
Branches 1284 1280 -4
==========================================
+ Hits 4538 4544 +6
+ Misses 5 3 -2
Partials 1 1
Continue to review full report at Codecov.
|
@tmorehouse Our current implementation of the This is the test setup I used in the playground: <div>
<input
v-model.trim="text1"
class="form-control mb-2"
@input="onInput('text1', $event.target.value)"
@change="onChange('text1', $event.target.value)"
>
<input
v-model.trim.number="text2"
class="form-control mb-2"
@input="onInput('text2', $event.target.value)"
@change="onChange('text2', $event.target.value)"
>
<input
v-model.lazy.trim="text3"
class="form-control mb-2"
@input="onInput('text3', $event.target.value)"
@change="onChange('text3', $event.target.value)"
>
<b-form-input
v-model="text4"
class="mb-2"
@input="onInput('text4', $event)"
@change="onChange('text4', $event)"
></b-form-input>
<b-form-input
v-model="text5"
trim
lazy
@input="onInput('text5', $event)"
@change="onChange('text5', $event)"
></b-form-input>
</div> {
data() {
return {
text1: '',
text2: '',
text3: '',
text4: '',
text5: '',
}
},
methods: {
onInput(name, value) {
const localValue = this[name]
console.log('input', name, value, localValue, value === localValue)
},
onChange(name, value) {
const localValue = this[name]
console.log('change', name, value, localValue, value === localValue)
}
}
} |
lazy
modifier prop to update v-model on change/blur event
Describe the PR
Adds a new prop
lazy
to<b-form-input>
and<b-form-textarea>
, to only update the v-model onchange
/blur
event, emulating the Vue.lazy
modifierTarget release: v2.1.0
To Do:
lazy
propPR checklist
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
The PR fulfills these requirements:
dev
branch, not themaster
branch[...] (fixes #xxx[,#xxx])
, where "xxx" is the issue number)fix(alert): not alerting during SSR render
,docs(badge): update pill examples, fix typos
,chore: fix typo in README
, etc). This is very important, as theCHANGELOG
is generated from these messages.If new features/enhancement/fixes are added or changed:
package.json
for slot and event changes)If adding a new feature, or changing the functionality of an existing feature, the PR's
description above includes: