1,组件名

  官方推荐的组件名是 每个单词首字母大写(PascalCase) 或者 全小写用 - 连接(kebab-case) 。 在DOM中使用的时候, 改为全小写, 单词之间用 - 连接

  

vue 中命名规范
Vue.component('MyComponent', {});    或者      Vue.component('my-component', {});
import MyComponent from 'MyComponent.vue'; export default { name: 'MyComponent' } 在DOM中使用的时候, <my-component></my-component>
vue 中命名规范

 

2,props

  声明 prop的时候, 使用驼峰命名(myProps), 模板中使用的时候, 用 - 连接(my-props)

props: {
    myProps: {}
}

<my-component :my-props="abc"></my-component>

 

3,自定义事件名

  因为html对大小写不敏感,所以大写的都会被转为小写的。 所以推荐 都用 -连接来命名。

this.$emit('my-event');

<my-component @my-event="abc"></my-component>

 https://www.cnblogs.com/wjyz/p/10874831.html

相关文章:

  • 2021-11-20
猜你喜欢
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-08-11
  • 2022-12-23
  • 2021-09-24
相关资源
相似解决方案