How does vue modify variables for calculation properties?

computed: {
    nowDate () {
      return utils.formatTime(new Date(), "date")
    }
  },
  methods: {
    bindPickerChange (e) {
      this.nowDate = e.value
    }
  }

the nowdate variable defined in computed does not work to modify nowdate in bindPickerChange?

May.14,2021

the calculation attribute depends on data. Even if you change the calculation attribute, the data does not change, so it does not change


need to write set function

computed: {
    nowDate:{
      get ()  {},
      set (newValue) {}
    }
  },

refer to the official documentation. You need to provide a setter for the computed attribute assignment.
ide/computed.html-sharp%E8%AE%A1%E7%AE%97%E5%B1%9E%E6%80%A7%E7%9A%84-setter" rel=" nofollow noreferrer "> calculate the setter of the attribute


you can try watch to listen to your data value, and then do something

  

have you solved the problem behind the owner of the building?

Menu