1. Value Change trigger time
After the view is changed, the focus leaves the current Dom element, and the value of view-model changes. You can setValueupdate: "afterkeydown"
To change the view value, the view-model value changes immediately (similar to the onkeyup event ).
After the view-model is changed, the value of the view changes immediately.
2. Pay attention to the transfer of reference and Value
Value transfer, the most common is that your model type is string and number, so you changed the value of the model, the view-model remains unchanged.
For reference transfer, the most common is the array type. Your model type array data, shift (), your view-model changes, and your view changes.
3. Select element Click Event
Select element. You have bound a click event, which is actually a double-click event. Its click event is change.
4. foreach binding
1. The required array format is [{key: value1}, {key: value2}], which may be different from the array format saved in your database. Therefore, you need a conversion function.
2. If you want to bind the array format [value1, value2, value3], use $ data. However, this will only display data. If you modify the data in the view, the view-model will not be affected because this is a value transfer.
Iii. $ Parent concept. The current object is in the set and is often used for remove. $ Root refers to set a packet Set B packet set C, $ root of set C is set a, and $ parent of set C is set B.
5. bind
Foreach is bound to an array, while with is bound to an object.
6. Custom binding
Now you can bind the value and text fields to the knockout, and write the yourname binding.