Topic: Vue js - v-model problem

SirComix pro asked 5 years ago


Hello,

when i bind some variable to mdb input, it doesn't show.

<mdb-input id="name" label="Project name" v-model="detail.name"/>

Please there is some option you will repair it ?

 

Thank you for your answer


Felex free answered 3 years ago


@Mikołaj Smoleński's answer is working perfectly.Thank you


Mikołaj Smoleński staff answered 5 years ago


Since the next release You'll be able to use v-model also instead of @input event.

Here's the example:

<mdb-input type="text" label="Basic example" v-model="test" />

data() {
return {
test: 'Test'
};
},
watch: {
test() {
console.log(this.test);
}
}


Best Regards


Mikołaj Smoleński staff answered 5 years ago


Hi there,

Currently You're able to set input's value by adding attribute 'value' to it. Also You can get dynamically changed value using '@input' event. Here's the example code:

<mdb-input type="text" label="Basic example" value="Example value" @input="handleInput"/>

...
methods: {
 handleInput (val) {
  console.log(val);
 }
}
 
Is this enough for Your needs?
 
Best Regards

 



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Vue
  • MDB Version: 4.8.2
  • Device: PC
  • Browser: Firefox
  • OS: Ubuntu 18.10
  • Provided sample code: No
  • Provided link: No