兵兵有你

人品好,气质差.丢了工作就回家...

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

由于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>

 

 

 

 

a.VScode保持vue语法高亮的方式:

1.安装插件:vetur。打开VScode,Ctrl + P 然后输入 ext install vetur 然后回车点安装即可。


2.在 VSCode中使用 Ctrl+Shift+P打开命令面板,输入Preferences: Open Settings(JSON)。


3.在配置对象里加上key和value

1 "emmet.syntaxProfiles": {
2     "vue-html": "html",
3     "vue": "html"
4 }

4.当执行npm run serve时提示的语法错误解决方法:
  a.安装npm i prettier -g
  b. 根目录建立文件 .prettierrc
    
{
    "tabWidth": 4,
    "semi": true,
    "singleQuote": true,
    "bracketSpacing": true,
}

  


  c.相应的文件里格式化代码 alt+shift+f
  d. 再重新运行项目

posted on 2019-12-19 14:28  greatbing  阅读(229)  评论(0编辑  收藏  举报