The problem of passing values in vue components

topic description

when learning the component communication of vue according to the video tutorial, achieve the following effect:

Click on the first line of text, all text becomes dell,
Click on the second line of text, all text becomes lenov
but my effect is that after the first line becomes dell, clicking on the second line does not reflect the
attached code:

.
<div id="app">
        <child content="dell"></child>
        <child content="lenov"></child>
    </div>
</body>
<script src="../lib/vue.js"></script>
<script>
    Vue.prototype.bus=new Vue();

    Vue.component("child",{

        data:function() {
            return {
                cont:this.content
            }
        },
        props: {
            content:{
                type:String,
                // default:"it is default"
            }
        },
        template:"<div @click="handleClick">{{cont}}</div>",
        methods: {
            handleClick:function(){
                this.bus.$emit("change",this.cont);
            }
        },
        mounted: function() {
            var that=this;
            this.bus.$on("change",function(msg){
                that.cont=msg
            })
        }
    })

    var vm=new Vue({
        el:"-sharpapp",
        
    })
</script>

Let"s take a look at what"s wrong with my code and how to modify it

Sep.02,2021

Click on the first line to trigger the event handleClick
and then notify change event passing in parameters cont > value dell
the two change events you define are triggered to change the cont value of the current component to dell
, no matter which one you click is cont value is dell

this.bus.$emit('change',this.content);

change the value passed in to content of prop because you haven't changed the value from the beginning

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-1b31ad6-40df5.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-1b31ad6-40df5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?