Vue introduces an object through import, assigns the object to data, and then asynchronously modifies the value of the property of the object in data. Vue cannot listen.

vue introduces an object through import, assigns the object to data, and then asynchronously modifies the value of the property of this object in data. Vue cannot listen

.

this object has the following format:

import { staticObj } from "./a.js"

data() {
  return {
    staticObj: staticObj 
  }
}

async created() {
  const list = await api.getList()
  this.staticObj[0].filters = list  // vuefilters 
}
Oct.28,2021

vue cannot add properties to an object in this way, and the view cannot be updated. The correct results are as follows:

this.$set(this.staticObj[0],'filters',list)

your staticObj is an array. You can use push , splice , Vue.set (vm.items, indexOfItem, newValue)
), please refer to ide/list.html-sharp%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.

.
Menu