Using the new syntax of ES6 in vue watch, I don't understand why it can be used in this way.

let vm = new Vue({
  el: "-sharpapp",
  data: {
    number: 0
  },
  methods: {
    res() {
      console.log("")
    }
  },
  watch: {
    number: ["res"]
  }
})

watchnumberES6[res],["res"]methodsres
Mar.18,2021

directly write [res] , js how do I know what this res refers to?

know that for js parsers, watch.number: [res] and methods.res are completely unrelated.

Vue cannot exceed the expressive power of js syntax, so the only way to write this monitor is that Vue will help you to find a corresponding function in methods .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eae84a-5cffc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eae84a-5cffc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?