[Vuejs]-Dynamic change types,lable Vue js

2👍

First you need to declare this in your data:

data () {
  return {
    inputType: "text",
    lableName: "Default",
  }
}

Now you use these variables in your html:

<label>{{ lableName }}</label>
<input :type="inputType">

The last part is to define the logic when these values change. However, I don’t know when or why you want to change this. If you elaborate I can edit.

Hope this helps already 🙂

1👍

You can use below syntax to make it dynamic
For html:

<input :type="inputType">

In data:

data () {
  return {
    inputType: 'text'
  };
}

Leave a comment