@@ -31,11 +31,9 @@ export const BFormRadio = /*#__PURE__*/ Vue.extend({
3131 }
3232 } ,
3333 computed : {
34- // Radio Groups can only have a single value, so determining if checked is simple
3534 isChecked ( ) {
3635 return looseEqual ( this . value , this . computedLocalChecked )
3736 } ,
38- // Flags for form-radio-check mixin
3937 isRadio ( ) {
4038 return true
4139 } ,
@@ -44,21 +42,30 @@ export const BFormRadio = /*#__PURE__*/ Vue.extend({
4442 }
4543 } ,
4644 watch : {
47- // Radio Groups can only have a single value, so our watchers are simple
48- computedLocalChecked ( ) {
49- this . $emit ( 'input' , this . computedLocalChecked )
45+ computedLocalChecked ( newValue , oldValue ) {
46+ if ( ! looseEqual ( newValue , oldValue ) ) {
47+ this . $emit ( 'input' , newValue )
48+ }
5049 }
5150 } ,
5251 methods : {
5352 handleChange ( { target : { checked } } ) {
54- const value = this . value
53+ const { value } = this
54+ const localChecked = checked ? value : null
55+
5556 this . computedLocalChecked = value
56- // Change is only emitted on user interaction
57- this . $emit ( 'change' , checked ? value : null )
58- // If this is a child of form-radio-group, we emit a change event on it as well
59- if ( this . isGroup ) {
60- this . bvGroup . $emit ( 'change' , checked ? value : null )
61- }
57+
58+ // Fire events in a `$nextTick()` to ensure the `v-model` is updated
59+ this . $nextTick ( ( ) => {
60+ // Change is only emitted on user interaction
61+ this . $emit ( 'change' , localChecked )
62+
63+ // If this is a child of `<form-radio-group>`,
64+ // we emit a change event on it as well
65+ if ( this . isGroup ) {
66+ this . bvGroup . $emit ( 'change' , localChecked )
67+ }
68+ } )
6269 }
6370 }
6471} )
0 commit comments