Skip to content

Commit 4ea77d5

Browse files
committed
规范及简化组件写法,拆分插件和组件至不同目录
1 parent 99a08b7 commit 4ea77d5

File tree

38 files changed

+146
-295
lines changed

38 files changed

+146
-295
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!-- 引用或解释说明组件 -->
21
<template>
32
<div class="sys-notes">
43
<slot></slot>
@@ -7,6 +6,6 @@
76

87
<script>
98
export default {
10-
name: 'vPageNotes'
9+
name: 'AppNotes'
1110
}
1211
</script>

src/components/platformCom/pageSearch/main.vue renamed to src/components/AppSearch/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
<script>
88
export default {
9-
name: 'vPageSearch'
9+
name: 'AppSearch'
1010
}
1111
</script>

src/components/platformCom/pageSection/main.vue renamed to src/components/AppSection/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<script>
1111
export default {
12-
name: 'vPageSection',
12+
name: 'AppSection',
1313
props: ['title']
1414
}
1515
</script>
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<!-- 每个页面的标题,用来重复确认当前所处页面,亦可用作面包屑导航的外层结构。 -->
21
<template>
32
<div class="sys-title">
43
<strong>{{title}}</strong>
@@ -7,7 +6,7 @@
76

87
<script>
98
export default {
10-
name: 'vPageTitle',
9+
name: 'AppTitle',
1110
props: ['title']
1211
}
1312
</script>

src/components/platformCom/pageToolbar/main.vue renamed to src/components/AppToolbar/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<script>
88
export default {
9-
name: 'vPageToolbar',
9+
name: 'AppToolbar',
1010
props: {
1111
align: {
1212
type: String,

src/components/platformCom/pageTable/main.vue renamed to src/components/TableMixin/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<script>
2424
export default {
25-
name: 'vPageTable',
25+
name: 'TableMixin',
2626
props: {
2727
pagination: Boolean,
2828
paginationAlign: String,

src/components/customCom/global/install.js

Whitespace-only changes.

src/components/install.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// 组件全局注册
2+
import Vue from 'vue'
3+
4+
import AppNotes from './AppNotes'
5+
import AppTitle from './AppTitle'
6+
import AppToolbar from './AppToolbar'
7+
import AppSection from './AppSection'
8+
import AppSearch from './AppSearch'
9+
import TableMixin from './TableMixin'
10+
11+
// 组件库
12+
const Components = [
13+
AppNotes,
14+
AppTitle,
15+
AppToolbar,
16+
AppSection,
17+
AppSearch,
18+
TableMixin
19+
]
20+
21+
// 注册全局组件
22+
Components.map((com) =>{
23+
Vue.component(com.name, com)
24+
})
25+
26+
export default Vue

src/components/platformCom/install.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/components/platformCom/pageNotes/index.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/components/platformCom/pageSearch/index.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/components/platformCom/pageSection/index.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/components/platformCom/pageTable/index.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/components/platformCom/pageTitle/index.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/components/platformCom/pageToolbar/index.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import axios from './util/ajax'
1111
import i18n from './util/i18n'
1212
import App from './index'
1313

14-
import './components/platformCom/install'
14+
import './components/install'
15+
import './plugins/install'
1516

1617
// 注册组件到Vue
1718
Vue.prototype.$axios = axios

src/page/components/assist/pageNotes.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<div class="sys-page">
3-
<v-pageTitle title="引用说明"></v-pageTitle>
3+
<app-title title="引用说明"></app-title>
44
<div class="page-content">
5-
<v-pageNotes>
5+
<app-notes>
66
现在看到的就是引用说明组件
7-
</v-pageNotes>
8-
<v-pageSection title="组件说明">
7+
</app-notes>
8+
<app-section title="组件说明">
99
<el-table :data="tableData" style="width: 100%">
1010
<el-table-column prop="name" label="组件使用">
1111
</el-table-column>
@@ -18,7 +18,7 @@
1818
<el-table-column prop="paramType" label="参数类型">
1919
</el-table-column>
2020
</el-table>
21-
</v-pagesection>
21+
</app-section>
2222
</div>
2323
</div>
2424
</template>
@@ -29,7 +29,7 @@ export default {
2929
return {
3030
tableData: [
3131
{
32-
name: '<v-pageNotes></v-pageNotes>',
32+
name: '<app-notes></app-notes>',
3333
detail: '可以插入任意节点,外层仅为有样式的<div>层',
3434
param: '-',
3535
paramDetail: '-',

src/page/components/function/pageTable.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
22
<div class="sys-page">
3-
<v-pageTitle title="统一分页插件"></v-pageTitle>
3+
<app-title title="统一分页插件"></app-title>
44
<div class="page-content">
55
<div class="article">
66
<p>该组件为ElementUI的分页组件二次封装,以实现统一的分页设置。分页所有方法统一继承自ElementUI</p>
77
</div>
8-
<v-pageTable pagination></v-pageTable>
9-
<v-pageSection title="函数说明">
8+
<table-mixin pagination></table-mixin>
9+
<app-section title="函数说明">
1010
<el-table :data="tableData" style="width: 100%">
1111
<el-table-column prop="name" label="组件使用">
1212
</el-table-column>
@@ -19,7 +19,7 @@
1919
<el-table-column prop="paramType" label="参数类型">
2020
</el-table-column>
2121
</el-table>
22-
</v-pagesection>
22+
</app-section>
2323
</div>
2424
</div>
2525
</template>
@@ -30,7 +30,7 @@ export default {
3030
return {
3131
tableData: [
3232
{
33-
name: '<v-pageTable></v-pageTable>',
33+
name: '<table-mixin></table-mixin>',
3434
detail: '统一table',
3535
param: 'pagination',
3636
paramDetail: '是否有分页',

src/page/components/function/permission.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
22
<div class="sys-page">
3-
<v-pageTitle title="详细鉴权组件"></v-pageTitle>
3+
<app-title title="详细鉴权组件"></app-title>
44
<div class="page-content">
55
<div class="sys-article">
66
<p>该组件并非鉴别页面访问权限,实际是鉴别页面内部某些按钮或操作的权限。</p>
77
<p>页面中的某些操作或者某些区块拥有访问等其他权限时,只需要添加<code>v-hasPermission="'view'"</code>即可。</p>
88
</div>
9-
<v-pageSection title="函数说明">
9+
<app-section title="函数说明">
1010
<el-table :data="tableData" style="width: 100%">
1111
<el-table-column prop="name" label="指令名">
1212
</el-table-column>
@@ -15,7 +15,7 @@
1515
<el-table-column prop="type" label="参数类型">
1616
</el-table-column>
1717
</el-table>
18-
</v-pagesection>
18+
</app-section>
1919
</div>
2020
</div>
2121
</template>

src/page/components/index.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<div class="sys-page" v-once>
3-
<v-pageTitle title="介绍"></v-pageTitle>
3+
<app-title title="介绍"></app-title>
44
<div class="page-content">
5-
<v-pageNotes>
5+
<app-notes>
66
该部分组件为本系统自行开发的组件(包括对第三方组件的封装),不包括纯粹的第三方组件。系统组件仅为通用的大众化组件,需注意和项目组件进行区分。全部系统组件文件位于 src/components/platformCom
7-
</v-pageNotes>
8-
<v-pageSection title="使用方法">
7+
</app-notes>
8+
<app-section title="使用方法">
99
<div class="sys-article">
1010
<p>系统组件默认使用全局注册,无需再次引入。如果需要按需引入,只需在<code>src/main.js</code>中取消对全局组件的引入即可。如下所示</p>
1111
<pre v-pre class="sys-pre"><code>
@@ -18,15 +18,15 @@
1818
</code></pre>
1919
<p>如果需要取消部分全局组件的应用,则修改<code>src/components/platformCom/install.js</code>的引入组件即可</p>
2020
</div>
21-
</v-pageSection>
22-
<v-pageSection title="分类说明">
21+
</app-section>
22+
<app-section title="分类说明">
2323
<div class="sys-article">
2424
<p>系统组件主要分为三大类</p>
2525
<p>功能类:以实现具体功能为主,包括对第三方组件的二次封装类,尽量不要修改。</p>
2626
<p>布局类:以常用布局为主,包括标题、间距、搜索之类的纯布局组件,可按实际项目要求修改</p>
2727
<p>辅助类:文档辅助说明及其他组件部分,可能不会应用在正式产品中,该类别可以不引入到正式产品中</p>
2828
</div>
29-
</v-pageSection>
29+
</app-section>
3030
</div>
3131
</div>
3232
</template>

src/page/components/ui/pageSearch.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<div class="sys-page">
3-
<v-pageTitle title="搜索条"></v-pageTitle>
3+
<app-title title="搜索条"></app-title>
44
<div class="page-content">
5-
<v-pageSearch>
5+
<app-search>
66
现在看到的就是搜索条
7-
</v-pageSearch>
8-
<v-pageSection title="组件说明">
7+
</app-search>
8+
<app-section title="组件说明">
99
<el-table :data="tableData" style="width: 100%">
1010
<el-table-column prop="name" label="组件使用">
1111
</el-table-column>
@@ -18,7 +18,7 @@
1818
<el-table-column prop="paramType" label="参数类型">
1919
</el-table-column>
2020
</el-table>
21-
</v-pagesection>
21+
</app-section>
2222
</div>
2323
</div>
2424
</template>
@@ -29,7 +29,7 @@ export default {
2929
return {
3030
tableData: [
3131
{
32-
name: '<v-pageSearch></v-pageSearch>',
32+
name: '<app-search></app-search>',
3333
detail: '可以插入任意节点,外层仅为有样式的<div>层',
3434
param: '-',
3535
paramDetail: '-',

src/page/components/ui/pageSection.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<template>
22
<div class="sys-page">
3-
<v-pageTitle title="子区域"></v-pageTitle>
3+
<app-title title="子区域"></app-title>
44
<div class="page-content">
5-
<v-pageSection title="子区域标题">
5+
<app-section title="子区域标题">
66
子区域任意内容
7-
</v-pageSection>
8-
<v-pageSection title="组件说明">
7+
</app-section>
8+
<app-section title="组件说明">
99
<el-table :data="tableData" style="width: 100%">
1010
<el-table-column prop="name" label="组件使用">
1111
</el-table-column>
@@ -18,7 +18,7 @@
1818
<el-table-column prop="paramType" label="参数类型">
1919
</el-table-column>
2020
</el-table>
21-
</v-pagesection>
21+
</app-section>
2222
</div>
2323
</div>
2424
</template>
@@ -29,7 +29,7 @@ export default {
2929
return {
3030
tableData: [
3131
{
32-
name: '<v-pageSection></v-pageSection>',
32+
name: '<app-section></app-section>',
3333
detail: '该区域为详细区域分块',
3434
param: 'title',
3535
paramDetail: '定义分块标题',

0 commit comments

Comments
 (0)