The vue.js parent and child components pass values dynamically.

problem description

my tree child component receives the data passed by the parent component, clicks the parent component button to modify the data passed to the child component, and reports such an error.

the environmental background of the problems and what methods you have tried

my sub-component uses watch to listen deeply on incoming objects, but it still doesn"t work.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

< base-tree: treeHeight= "(height-40)": load= "true": treeId= "6655" v MutomonParc treeChange = "treeClick": treeDataObj= "treeObj" > < / base-tree >

    watch: {
        treeDataObj: {
            handler(newVal, oldVal) {
                this.sw = false;
                if (newVal) {
                    this.nodeArray=[];
                    this.index = newVal.index;
                    this.groupId = "";
                    this.isUser = newVal.isUser;
                    this.ztreeDataSourceSync = [];
                    if(newVal.searchText){
                        this.searchText = newVal.searchText;
                        this.treeSearch();
                    }else{
                        this.page = 1;
                        this.loadUserGroupTreeFromEs();
                    }
                }
            },
            deep: true //
        },

what result do you expect? What is the error message actually seen?

Mar.25,2021

the value passed by the parent component to the child component through props cannot be changed directly in the child component.
isn't it obvious to check the code


error message based on this? You cannot change the value of props directly in a subcomponent. If you want to use this value, please decouple it in data or computed. Normally, if you pass an object in props, you will not change it in a subcomponent. Warn's personal guess is that warn

after deep.
Menu