Skip to content

v-model with custom radio component replace onChange event #3516

@clegendre

Description

@clegendre

Hello,

I'm writing a data-driven custom component that renders different input types from its data.
This component supports types like radio / checkbox / textarea etc.

All these types works fine with v-model directive on the component except of the radio type.

I found why: Vue2 hooks up the onChange event by adding :
'onChange': function(event){ myProp = undefined }

The component looks like this:

<dyn-component type="radio" ... ></dyn-component>

and renders something like this:

<div class="form-group">
  <label><input type="radio" /></label> 
  <label><input type="radio" /></label>
</div>

In fact, Vue2 considers that my component is an input type="radio" but this component renders internaly a radio-button list...

The workaround I used is to change the type from radio to radio-list, but maybe Vue should also check the tag name to be input in addition to the type="radio" attribute check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions