Vue computed calculation attribute when the dependent property is updated, the calculation property is not executed?

computed: {
    comp: function () {
        return () => import(`./component/item${this.formItem.item_type}.form`);
    }
},

when I switch the value of this.formItem.item_type, comp is not triggered

computed: {
    comp: function () {
        console.log(this.formItem.item_type)
        return () => import(`./component/item${this.formItem.item_type}.form`);
    }
},

when I add console.log (this.formItem.item_type), it triggers normally, but comment out doesn"t trigger normally. Why?

in addition: I use watch to monitor normal

watch:{
    "formItem.item_type": function (val, oldVal) {
        this.comp = () => import(`./component/item${this.formItem.item_type}.form`);
    }
},

supplement this.formItem objects

clipboard.png

Mar.23,2021

first check whether this.formItem.item_type is responsive. Expand to this point with the developer tool, if it is (.) or if there is a light-colored get/set below, otherwise, this variable is not observed, so there is no response.


because only if you access the corresponding variable in the evaluation property, the calculation property can form a dependence on it.

comp: function () {
    // ,  comp 
    this.formItem.item_type;
  
    return () => import(`./component/item${this.formItem.item_type}.form`);
}
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-1e5b0d2-44e3a.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-1e5b0d2-44e3a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?