Vue .sync修饰符与$emit(update:xxx)写法问题

在学习vue自定义事件的.sync修饰符实现改变数值时发现一个问题如下
由于props的大小写命名:fatherNum,对应不同的$emit()会有不同的效果,具体如下:

使用.sync修饰符,即

    // this.$emit('update:father-num',100);  //无效
    this.$emit('update:fatherNum',100); //有效
    //......
    <father v-bind:father-num.sync="test"></father>

不使用.sync,即

      this.$emit('update:father-num',100);  //有效
      //this.$emit('update:fatherNum',100); // 无效
      
      //......
     <father v-bind:father-num="test" v-on:update:father-num="test=$event" ></father>
原文地址:https://www.cnblogs.com/mmzuo-798/p/13271612.html