Topic: Cannot change input value programmatically
smiker answered 6 years ago
I solved it using mixin, hope it will be useful
Mixin `input.vue`:
<script>
import { Input } from 'mdbvue'
export default {
extends: Input,
watch: {
value: function (val) {
this.innerValue = val
}
}
}
</script>
Now it can be using in components as:
<template lang="pug">
f-input(type='text', value='', label="Name", v-model="user_name")
</template>
<script>
import Inpt from '@/components/input'
export default {
components: {
'f-input': Inpt
},
data() { return {
user_name: "test_name"
}}
}
</script>
Jakub Strebeyko staff answered 6 years ago
shilu911 pro commented 6 years ago
Hi Jakub, My solution is changing the component name in the input.vue from "component" to "input", then it started to work. btw, your notification system sent me 7 emails when you posted your answer here. Best Regards, Lu ShiJakub Strebeyko staff commented 6 years ago
Hi, There seems to be little justification for not making input an component, right - we will have a look into that and have it fixed shortly. When it comes to the notification - there is a task force already delegated to investigate. Thanks for all this valuable input! Best Regards, Kubasmiker commented 6 years ago
Hi Jakub,
How is the fix going?
Jakub Strebeyko staff commented 6 years ago
It is scheduled for the release by the end of the month, but it is to be treated as an ETA, not a promise. In the meantime, for people operating on our code base, have you perhaps tried Lu Shi's solution? I worked the last time I checked.
Best,
Kuba
Jakub Strebeyko staff answered 6 years ago
Hi,
This will be probably how the issue will get handle in the official release, too. Thanks for reaching out!
Kuba
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB Vue
- MDB Version: 4.6.0
- Device: iMac
- Browser: Chrome
- OS: MacOS
- Provided sample code: No
- Provided link: No