What are the unknown bugs in vue 2.0

1: this.$router.query passes the parameter type number, which will be automatically converted to a string after refresh

Solution: Type forced transfer

2: Vue cannot detect the following changed arrays

  1. When using the index to directly change or set an item, for example: this.items[index] = newvalue.
  2. When modifying the length of the array, for example: this.items.lenght = newValue

Solution:

The first type of solution:

// Vue.set
this.$set(this.items, indexOfItem, newValue)

// Array.prototype.splice
this.items.splice(indexOfItem, 1, newValue)
复制代码

The second type of solution:

vm.items.splice(newLength)

Guess you like

Origin blog.csdn.net/lianjiuxiao/article/details/113049964