vuejs/vue

Vue variable not updated.

vad11 opened this issue ยท 10 comments

vad11 commented

Version

2.4.1

Reproduction link

http://jsfiddle.net/vadvad/1pohLabg/22/

Steps to reproduce

Vue variable not updated after resive change message.

What is expected?

type = ok

What is actually happening?

type = not

Why using jQuery to do that? Did a quick fix to your fiddle:
http://jsfiddle.net/vadvad/1pohLabg/9/

vad11 commented

@vad11, v-model listens for input event to detect changes, doing something.value = 'new value' doesn't trigger input event.

vad11 commented

Yes, but I send document.querySelector('input[name=type]').trigger('change') ;

@vad11 - you don't need and shouldn't use jQuery or document.querySelector when using Vue's v-model. All you have to do is the following: http://jsfiddle.net/1pohLabg/24/

I would recommend you read the Vue Guide, in particular Handling User Input. There might be some misunderstanding about how Vue should be used.

vad11 commented

I use jquery plugin in working project (select list, time, ...). Plugin make many operation and I want resive result from plugin by setting value to hidden input variable. This is clean and simply way to do this. If I work with vue you massege accepted, but this is not state. I must change value from jquery plagin and trigger vue to update this variable. This not work. Vue not update variable.

posva commented

Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server, gitter or StackOverflow.


Vue cannot listen back to setting the value directly into the DOM element

vad11 commented

Please see #372 in bug reports. Writed that is solved, but I make this and for me this not work. May be this bug. I don't now. But please help me solve this problem.

I'm tryng to e2e with cypress and datetimepicker (vuetify). I setup an hidden input, triggered the change as expected, but the model doesnt get any update