Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial values in inputs #150

Open
dbarrington opened this issue Aug 27, 2017 · 4 comments
Open

Initial values in inputs #150

dbarrington opened this issue Aug 27, 2017 · 4 comments

Comments

@dbarrington
Copy link

dbarrington commented Aug 27, 2017

Hi, just getting into this. I have read the docs, but I'm having trouble getting initial values into the inputs. I was expecting the initial value would be the value assigned to whatever I put in v-model (activityName in this case), but the input is starting empty, like the Input.vue file is not passing the v-model into the input.

Pretty sure it's me, but what am I don't wrong?

<template>
<bsInput label="Activity Name" type="text" required v-model="activityName"></bsInput>
</template>


<script>  
var bsInput = require('vue-strap/src/Input');

data: () => ({
activityName: 'wave'
}),

components: {
bsInput
}
</script>
@dbarrington
Copy link
Author

Just to extend the question a little:

<div class="form-group">
  <label for="some-other-activity">Activity Name [non VueStrap]</label>
  <input type="text" name="some-other-activity" class="form-control" v-model="activityName">
</div>

<bsInput label="Activity Name [VueStrap]" type="text" required v-model="activityName"></bsInput>

screen shot 2017-08-27 at 9 15 46 am

@Turaylon
Copy link

I think there is a bug somewhere becouse on my project the input component does not show the value after some npm update.
This is my vue inspection and as you can see the value passed correctly
image

The code i used is simply this:
<bs-input v-model="registration_number" placeholder="Matricola"></bs-input>

@xpuu
Copy link

xpuu commented Jan 27, 2018

I think there's something wrong between dynamic components and v-model.

<textarea :is="type=='textarea'?type:'input'"

Despite of being elegant, this part fucks it up somehow. It's even impossible to set simple :value="val" with type="textarea" etc.

@bezborodow
Copy link

@xpuu, I did my own testing and removed the <textarea :is="type=='textarea'?type:'input'" and replaced it with <input>. It seemed to work fine after that. This seems to confirm your assertion in this regard. I might do a pull request to implement a fix to avoid using :is. It might be worth reporting this apparent bug upstream to Vue, also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants