Skip to content

[MdInput] causes v-model lag on mobile #1835

Open
@FossPrime

Description

@FossPrime

Version

vue 2.5.16
vue-material 1.0.0-beta-10.2

Reproduction link

https://codesandbox.io/s/7o3qm76x6j

The top field is an MdInput field, the bottom ones are normal fields... this all works fine on desktop, but the MdInput one is unusably slow to update on Chrome on Android emulator and real phones. It infact, won't update at all unless space is pressed or focus is lost

Working version with vue-material, but md-input swapped out
https://codesandbox.io/s/2z1k6wnwqr

Steps to reproduce

type two words on Chrome 66 on an Android phone or emulator. The pixel and pixel images work.

What is expected?

When you click "create todo" validateForm reads form.todo. Unfortunately, it only updates after every space bar press.

What is actually happening?

  • v-model contains everything but the last word.
  • Attempts to clear the model after submission are futile, as MdInput will pull the real value from it's local cache and apply it to the model, after the submit function is done doing what it needs to.

Why do we need a cache? why not just pass around the model directly as a property? Seems a bit overkill for an input field.


I tried v-model.lazy and initializing form to form: todo: ''... same issue

Workaround

Use nextTick with the promise syntax on your submit

 validateTodo () {
        this.$nextTick().then(() => {
          this.todos.push({ name: this.form.todo })
          this.form.todo = ''
        })
      }

kapture 2018-06-29 at 12 35 08

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions