v0.6.22

Two-way Binding

Last updated


This page explains how :model writes form input back into data.

Syntax


  1. <div id="app">
  2. <input type="text" :model="username" />
  3. <p>Hello, {{ username }}</p>
  4. </div>
  5. <script>
  6. const app = new QUI({ id: "app", data: { username: "" } });
  7. </script>
Live preview · @pardnchiu/quickui@0.6.22

Behavior per Element


ElementEventsValue written to app.data[key]
Text <input>, <textarea>keyup, changevalue, "" when empty
<select>changeThe selected option's value
<input type="checkbox">, <input type="radio">changeValues of every checked input on the page with the same name and type, joined with ,

:model on any other element is ignored.
中文