Vue.js 如何命名vue组件
我有四个组件:Vue.js 如何命名vue组件,vue.js,vue-component,Vue.js,Vue Component,我有四个组件:comments.vue,comments list.vue,comment.vue,comment new.vue comments.vue使用其他组件显示: 注释列表(没有任何ajax调用) a。其中包含单个注释(基本上它只是一个具有单个属性的模板) Textarea发送评论(有ajax调用) comments.vue具有加载分页注释的所有逻辑 所以我的问题是:责任分离好吗?你可以检查一下 从指南中: Vue组件名称 每个组件名称必须为: 有意义:不过分具体,不过分抽象 简短
comments.vue
,comments list.vue
,comment.vue
,comment new.vue
comments.vue
使用其他组件显示:
comments.vue
具有加载分页注释的所有逻辑
所以我的问题是:责任分离好吗?你可以检查一下
从指南中:
Vue组件名称
每个组件名称必须为:
- 有意义:不过分具体,不过分抽象
- 简短:2或3个单词
- 可发音:我们希望能够谈论它们
- 符合自定义元素规范:包括连字符,不使用保留字符 名字
- 应用程序-名称空间:如果非常通用,则为1个单词,以便 易于在其他项目中重用
<!-- recommended -->
<app-header></app-header>
<user-list></user-list>
<range-slider></range-slider>
<!-- avoid -->
<btn-group></btn-group> <!-- short, but unpronounceable. use `button-group` instead -->
<ui-slider></ui-slider> <!-- all components are ui elements, so is meaningless -->
<slider></slider> <!-- not custom element spec compliant -->