1. Regular Watch
data () { return { 0 }},watch: { frontpoints (newvalue, OldValue) { Console.log (NewValue) }}
2, array of Watch
data () { return { new Array (one). Fill (0) }},watch: {winchips: {h Andler (NewValue, OldValue) {for (Let i = 0; i < newvalue.length; i++) { if (Oldvalue[i]!=true }}
3. Watch for objects
data () { return' local ' } true }}
tips: As long as the attributes in the bet change (can be monitored), the handler function is executed, and if you want to monitor specific property changes, such as pokerhistory changes, the handler function is executed, you can use the calculated attribute computed to do the middle layer. Examples are as follows:
4, the object specific properties of the watch[utilization computed]
data () { return' local ' } }},computed: {pokerhistory () { re Turnthis. Bet.pokerhistory}},watch: {pokerhistory (newvalue, OldValue) {console.log (newvalue)}}< /c8>
Vue Watch Array or object