dpzvc-ui 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -18
- package/build-style.js +56 -5
- package/dist/dpzvc.js +86 -17
- package/dist/dpzvc.js.map +1 -1
- package/dist/dpzvc.min.js +1 -1
- package/dist/dpzvc.min.js.map +1 -1
- package/dist/styles/base/font.css +1 -0
- package/dist/styles/base/reset.css +1 -0
- package/dist/styles/base/variable.css +0 -0
- package/dist/styles/components/actionSheet.css +1 -0
- package/dist/styles/components/badge.css +1 -0
- package/dist/styles/components/button.css +1 -0
- package/dist/styles/components/card.css +1 -0
- package/dist/styles/components/cell-swipe.css +1 -0
- package/dist/styles/components/cell.css +1 -0
- package/dist/styles/components/checkBox.css +1 -0
- package/dist/styles/components/editor.css +1 -0
- package/dist/styles/components/header.css +1 -0
- package/dist/styles/components/indicator.css +1 -0
- package/dist/styles/components/loadmore.css +1 -0
- package/dist/styles/components/message.css +1 -0
- package/dist/styles/components/modal.css +1 -0
- package/dist/styles/components/number.css +1 -0
- package/dist/styles/components/picker.css +1 -0
- package/dist/styles/components/popup.css +1 -0
- package/dist/styles/components/progress.css +1 -0
- package/dist/styles/components/prompt.css +1 -0
- package/dist/styles/components/radioBox.css +1 -0
- package/dist/styles/components/slide-Bar.css +1 -0
- package/dist/styles/components/spinner.css +1 -0
- package/dist/styles/components/swipe.css +1 -0
- package/dist/styles/components/switchBar.css +1 -0
- package/dist/styles/components/tab.css +1 -0
- package/dist/styles/components/text.css +1 -0
- package/dist/styles/components/toTop.css +1 -0
- package/dist/styles/components/upload.css +1 -0
- package/dist/styles/utils/1px.css +1 -0
- package/dist/styles/utils/animation.css +1 -0
- package/dist/styles/utils/nowrap.css +1 -0
- package/package.json +2 -1
- package/src/index.js +113 -48
- package/src/styles/base/reset.less +77 -11
- package/src/styles/components/badge.less +2 -0
- package/src/styles/components/button.less +1 -0
- package/src/styles/components/checkBox.less +2 -0
- package/src/styles/components/header.less +2 -0
- package/src/styles/components/indicator.less +2 -0
- package/src/styles/components/modal.less +2 -0
- package/src/styles/components/number.less +2 -0
- package/src/styles/components/picker.less +2 -0
- package/src/styles/components/progress.less +2 -0
- package/src/styles/components/radioBox.less +2 -0
- package/src/styles/components/slide-Bar.less +2 -0
- package/src/styles/components/spinner.less +1 -0
- package/src/styles/components/tab.less +2 -0
- package/src/styles/components/text.less +2 -0
- package/src/styles/components/toTop.less +2 -0
- package/src/styles/utils/1px.less +2 -0
package/README.md
CHANGED
|
@@ -2,45 +2,129 @@
|
|
|
2
2
|
|
|
3
3
|
## 一、说明
|
|
4
4
|
|
|
5
|
-
> 一套基于Vue 2.X
|
|
5
|
+
> 一套基于 **Vue 2.X** 的通用组件库,提供丰富 UI 组件,并支持 **全量引入** 和 **按需引入**,同时提供公共样式、基础工具样式和服务组件方法(如 Message、Modal、Indicator)。
|
|
6
6
|
|
|
7
|
+
---
|
|
7
8
|
|
|
8
9
|
## 二、安装
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
```bash
|
|
12
|
+
npm install dpzvc-ui
|
|
13
|
+
|
|
13
14
|
```
|
|
15
|
+
---
|
|
14
16
|
|
|
15
|
-
> 引入之后,在你项目的入口通过import引入组件库
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
## 三、全量使用
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
全量引入组件库,包括 JS 组件和全量 CSS 样式(适合小型项目或快速开发)。
|
|
22
|
+
|
|
23
|
+
1. 引入组件库 JS
|
|
24
|
+
|
|
25
|
+
```bash
|
|
18
26
|
import Vue from 'vue'
|
|
19
|
-
import
|
|
27
|
+
import Dpzvc from 'dpzvc-ui'
|
|
28
|
+
|
|
29
|
+
Vue.use(Dpzvc)
|
|
30
|
+
```
|
|
20
31
|
|
|
21
|
-
|
|
32
|
+
2. 引入全量样式
|
|
22
33
|
|
|
34
|
+
/* 在入口文件或全局样式中引入 */
|
|
35
|
+
```bash
|
|
36
|
+
@import "~dpzvc-ui/dist/styles/dpzvc.css";
|
|
23
37
|
```
|
|
24
38
|
|
|
39
|
+
此方式会包含 components、base、utils 下的全部样式。
|
|
40
|
+
---
|
|
25
41
|
|
|
26
|
-
|
|
42
|
+
## 四、按需使用
|
|
27
43
|
|
|
44
|
+
按需引入可以减小打包体积,只引入你需要的组件及样式。
|
|
28
45
|
|
|
46
|
+
1. 引入组件
|
|
47
|
+
```bash
|
|
48
|
+
import Vue from 'vue'
|
|
49
|
+
import { VButton, VBadge } from 'dpzvc-ui'
|
|
50
|
+
|
|
51
|
+
Vue.component('VButton', VButton)
|
|
52
|
+
Vue.component('VBadge', VBadge)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. 引入组件 CSS
|
|
56
|
+
```bash
|
|
57
|
+
@import "~dpzvc-ui/dist/styles/components/button.css";
|
|
58
|
+
@import "~dpzvc-ui/dist/styles/components/badge.css";
|
|
29
59
|
```
|
|
30
|
-
|
|
60
|
+
3. 公共样式按需引入(可选)
|
|
61
|
+
```bash
|
|
62
|
+
@import "~dpzvc-ui/dist/styles/base/variables.css";
|
|
63
|
+
@import "~dpzvc-ui/dist/styles/base/reset.css";
|
|
64
|
+
@import "~dpzvc-ui/dist/styles/utils/mixins.css";
|
|
65
|
+
```
|
|
66
|
+
注意:按需引入组件时,如果组件依赖变量或 mixin,需要保证 base / utils 样式已引入。
|
|
31
67
|
|
|
32
|
-
|
|
33
|
-
// 省略部分html代码
|
|
34
|
-
</template>
|
|
68
|
+
---
|
|
35
69
|
|
|
36
|
-
|
|
70
|
+
## 五、服务组件使用
|
|
37
71
|
|
|
38
|
-
|
|
39
|
-
|
|
72
|
+
dpzvc-ui 提供一些 服务组件,无需注册即可使用,如:
|
|
73
|
+
• Message
|
|
74
|
+
• Modal
|
|
75
|
+
• Prompt
|
|
76
|
+
• Indicator
|
|
40
77
|
|
|
41
|
-
|
|
78
|
+
使用示例
|
|
79
|
+
```bash
|
|
80
|
+
import Vue from 'vue'
|
|
81
|
+
import Dpzvc from 'dpzvc-ui'
|
|
42
82
|
|
|
43
|
-
|
|
83
|
+
Vue.use(Dpzvc)
|
|
44
84
|
|
|
85
|
+
// 直接使用服务组件
|
|
86
|
+
Vue.prototype.$Message.success('操作成功!')
|
|
87
|
+
Vue.prototype.$Modal.alert('提示信息')
|
|
88
|
+
Vue.prototype.$Prompt('请输入内容')
|
|
89
|
+
Vue.prototype.$Indicator.show()
|
|
45
90
|
|
|
91
|
+
```
|
|
46
92
|
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## 六、目录结构(dist 打包示例)
|
|
96
|
+
```bash
|
|
97
|
+
dist/
|
|
98
|
+
└── styles/
|
|
99
|
+
├── dpzvc.css # 全量 CSS
|
|
100
|
+
├── components/
|
|
101
|
+
│ ├── button.css
|
|
102
|
+
│ ├── badge.css
|
|
103
|
+
│ └── ...
|
|
104
|
+
├── base/
|
|
105
|
+
│ ├── reset.css
|
|
106
|
+
│ ├── variables.css
|
|
107
|
+
│ └── ...
|
|
108
|
+
└── utils/
|
|
109
|
+
├── mixins.css
|
|
110
|
+
└── ...
|
|
111
|
+
```
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 七、开发和调试
|
|
115
|
+
开发组件请放在 src/components
|
|
116
|
+
• 公共变量、样式放在 src/styles/base
|
|
117
|
+
• 工具 mixin 放在 src/styles/utils
|
|
118
|
+
• 组件样式放在 src/styles/components
|
|
119
|
+
• Gulp 任务已支持按需打包和全量打包
|
|
120
|
+
---
|
|
121
|
+
## 八、注意事项
|
|
122
|
+
|
|
123
|
+
1. 按需引入组件时,请确保 依赖的 base / utils 样式 已引入,否则可能出现变量未定义的错误。
|
|
124
|
+
2. 服务组件如 Message、Modal 等无需单独注册,全局可直接使用。
|
|
125
|
+
3. 全量引入适合快速开发,但会增加打包体积;按需引入可减小体积,推荐生产环境使用。
|
|
126
|
+
|
|
127
|
+
⸻
|
|
128
|
+
|
|
129
|
+
现在可以开始在项目中愉快地使用 dpzvc-ui 组件库了 🎉
|
|
130
|
+
---
|
package/build-style.js
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
// const gulp = require('gulp');
|
|
2
|
+
// const less = require('gulp-less');
|
|
3
|
+
// const cleanCSS = require('gulp-clean-css');
|
|
4
|
+
// const rename = require('gulp-rename');
|
|
5
|
+
// const postcss = require('gulp-postcss');
|
|
6
|
+
// const autoprefixer = require('autoprefixer');
|
|
7
|
+
|
|
8
|
+
// function css() {
|
|
9
|
+
// return gulp.src('./src/styles/index.less')
|
|
10
|
+
// .pipe(less()) // 编译 less
|
|
11
|
+
// .pipe(postcss([autoprefixer()])) // 添加前缀
|
|
12
|
+
// .pipe(cleanCSS({ compatibility: 'ie8' })) // 压缩
|
|
13
|
+
// .pipe(rename('dpzvc.css'))
|
|
14
|
+
// .pipe(gulp.dest('./dist/styles'));
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
// // 默认任务
|
|
18
|
+
// exports.default = css;
|
|
19
|
+
|
|
20
|
+
|
|
1
21
|
const gulp = require('gulp');
|
|
2
22
|
const less = require('gulp-less');
|
|
3
23
|
const cleanCSS = require('gulp-clean-css');
|
|
@@ -5,14 +25,45 @@ const rename = require('gulp-rename');
|
|
|
5
25
|
const postcss = require('gulp-postcss');
|
|
6
26
|
const autoprefixer = require('autoprefixer');
|
|
7
27
|
|
|
8
|
-
|
|
28
|
+
// 打包组件 CSS
|
|
29
|
+
function componentsCSS() {
|
|
30
|
+
return gulp.src('./src/styles/components/*.less')
|
|
31
|
+
.pipe(less())
|
|
32
|
+
.pipe(postcss([autoprefixer()]))
|
|
33
|
+
.pipe(cleanCSS({ compatibility: 'ie8' }))
|
|
34
|
+
.pipe(rename({ dirname: '', extname: '.css' }))
|
|
35
|
+
.pipe(gulp.dest('./dist/styles/components'));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 打包 base CSS
|
|
39
|
+
function baseCSS() {
|
|
40
|
+
return gulp.src('./src/styles/base/*.less')
|
|
41
|
+
.pipe(less())
|
|
42
|
+
.pipe(postcss([autoprefixer()]))
|
|
43
|
+
.pipe(cleanCSS({ compatibility: 'ie8' }))
|
|
44
|
+
.pipe(rename({ dirname: '', extname: '.css' }))
|
|
45
|
+
.pipe(gulp.dest('./dist/styles/base'));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 打包 utils CSS
|
|
49
|
+
function utilsCSS() {
|
|
50
|
+
return gulp.src('./src/styles/utils/*.less')
|
|
51
|
+
.pipe(less())
|
|
52
|
+
.pipe(postcss([autoprefixer()]))
|
|
53
|
+
.pipe(cleanCSS({ compatibility: 'ie8' }))
|
|
54
|
+
.pipe(rename({ dirname: '', extname: '.css' }))
|
|
55
|
+
.pipe(gulp.dest('./dist/styles/utils'));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 打包全局 index.less
|
|
59
|
+
function globalCSS() {
|
|
9
60
|
return gulp.src('./src/styles/index.less')
|
|
10
|
-
.pipe(less())
|
|
11
|
-
.pipe(postcss([autoprefixer()]))
|
|
12
|
-
.pipe(cleanCSS({ compatibility: 'ie8' }))
|
|
61
|
+
.pipe(less())
|
|
62
|
+
.pipe(postcss([autoprefixer()]))
|
|
63
|
+
.pipe(cleanCSS({ compatibility: 'ie8' }))
|
|
13
64
|
.pipe(rename('dpzvc.css'))
|
|
14
65
|
.pipe(gulp.dest('./dist/styles'));
|
|
15
66
|
}
|
|
16
67
|
|
|
17
68
|
// 默认任务
|
|
18
|
-
exports.default =
|
|
69
|
+
exports.default = gulp.parallel(globalCSS, componentsCSS, baseCSS, utilsCSS);
|
package/dist/dpzvc.js
CHANGED
|
@@ -5959,6 +5959,32 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
5959
5959
|
|
|
5960
5960
|
// EXPORTS
|
|
5961
5961
|
__webpack_require__.d(__webpack_exports__, {
|
|
5962
|
+
ActionSheet: () => (/* reexport */ action_sheet),
|
|
5963
|
+
Badge: () => (/* reexport */ components_badge),
|
|
5964
|
+
Card: () => (/* reexport */ components_card),
|
|
5965
|
+
Cell: () => (/* reexport */ components_cell),
|
|
5966
|
+
CellSwipe: () => (/* reexport */ components_cell_swipe),
|
|
5967
|
+
CheckBox: () => (/* reexport */ checkBox),
|
|
5968
|
+
Header: () => (/* reexport */ Header),
|
|
5969
|
+
Indicator: () => (/* reexport */ components_Indicator),
|
|
5970
|
+
LoadMore: () => (/* reexport */ loadMore),
|
|
5971
|
+
Message: () => (/* reexport */ components_message),
|
|
5972
|
+
Modal: () => (/* reexport */ modal),
|
|
5973
|
+
Picker: () => (/* reexport */ components_picker),
|
|
5974
|
+
Popup: () => (/* reexport */ components_popup),
|
|
5975
|
+
Progress: () => (/* reexport */ components_progress),
|
|
5976
|
+
Prompt: () => (/* reexport */ components_prompt),
|
|
5977
|
+
Radio: () => (/* reexport */ radioBox),
|
|
5978
|
+
Rater: () => (/* reexport */ components_rater),
|
|
5979
|
+
SlideBar: () => (/* reexport */ components_slideBar),
|
|
5980
|
+
Spinner: () => (/* reexport */ components_spinner),
|
|
5981
|
+
Swipe: () => (/* reexport */ components_swipe),
|
|
5982
|
+
SwitchBar: () => (/* reexport */ components_switchbar),
|
|
5983
|
+
Tab: () => (/* reexport */ components_tab),
|
|
5984
|
+
TextBar: () => (/* reexport */ Text),
|
|
5985
|
+
ToTop: () => (/* reexport */ toTop),
|
|
5986
|
+
Upload: () => (/* reexport */ components_upload),
|
|
5987
|
+
VButton: () => (/* reexport */ components_button),
|
|
5962
5988
|
"default": () => (/* binding */ src)
|
|
5963
5989
|
});
|
|
5964
5990
|
|
|
@@ -13429,9 +13455,13 @@ var card_component = normalizeComponent(
|
|
|
13429
13455
|
/* harmony default export */ const components_card = (card);
|
|
13430
13456
|
;// ./src/index.js
|
|
13431
13457
|
/**
|
|
13432
|
-
* Created by admin on
|
|
13458
|
+
* Created by admin on 2025/12/15.
|
|
13433
13459
|
*/
|
|
13434
13460
|
|
|
13461
|
+
/* ========= 组件引入(保持你原有结构) ========= */
|
|
13462
|
+
|
|
13463
|
+
|
|
13464
|
+
|
|
13435
13465
|
|
|
13436
13466
|
|
|
13437
13467
|
|
|
@@ -13457,17 +13487,15 @@ var card_component = normalizeComponent(
|
|
|
13457
13487
|
|
|
13458
13488
|
|
|
13459
13489
|
|
|
13490
|
+
/* ========= 组件集合(用于全量注册) ========= */
|
|
13460
13491
|
|
|
13461
|
-
var
|
|
13492
|
+
var components = {
|
|
13462
13493
|
VButton: components_button,
|
|
13463
13494
|
CheckBox: checkBox,
|
|
13464
13495
|
CheckBoxGroup: checkBox.group,
|
|
13465
13496
|
Radio: radioBox,
|
|
13466
13497
|
RadioGroup: radioBox.group,
|
|
13467
13498
|
DpHeader: Header,
|
|
13468
|
-
Message: components_message,
|
|
13469
|
-
Modal: modal,
|
|
13470
|
-
Prompt: components_prompt,
|
|
13471
13499
|
Picker: components_picker,
|
|
13472
13500
|
Swipe: components_swipe,
|
|
13473
13501
|
Tab: components_tab,
|
|
@@ -13481,7 +13509,6 @@ var dpzvc = {
|
|
|
13481
13509
|
Spinner: components_spinner,
|
|
13482
13510
|
LoadMore: loadMore,
|
|
13483
13511
|
Popup: components_popup,
|
|
13484
|
-
Indicator: components_Indicator,
|
|
13485
13512
|
DpProgress: components_progress,
|
|
13486
13513
|
ToTop: toTop,
|
|
13487
13514
|
Cell: components_cell,
|
|
@@ -13489,22 +13516,64 @@ var dpzvc = {
|
|
|
13489
13516
|
Badge: components_badge,
|
|
13490
13517
|
Card: components_card
|
|
13491
13518
|
};
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13519
|
+
|
|
13520
|
+
/* ========= 服务组件 ========= */
|
|
13521
|
+
|
|
13522
|
+
var services = {
|
|
13523
|
+
Message: components_message,
|
|
13524
|
+
Modal: modal,
|
|
13525
|
+
Prompt: components_prompt,
|
|
13526
|
+
Indicator: components_Indicator
|
|
13527
|
+
};
|
|
13528
|
+
|
|
13529
|
+
/* ========= 给“单个组件”补 install(关键) ========= */
|
|
13530
|
+
|
|
13531
|
+
Object.keys(components).forEach(function (key) {
|
|
13532
|
+
var component = components[key];
|
|
13533
|
+
if (!component.install) {
|
|
13534
|
+
component.install = function (Vue) {
|
|
13535
|
+
Vue.component(key, component);
|
|
13536
|
+
};
|
|
13537
|
+
}
|
|
13538
|
+
});
|
|
13539
|
+
Object.keys(services).forEach(function (key) {
|
|
13540
|
+
var service = services[key];
|
|
13541
|
+
if (!service.install) {
|
|
13542
|
+
service.install = function (Vue) {
|
|
13543
|
+
Vue.prototype["$".concat(key)] = service;
|
|
13544
|
+
};
|
|
13545
|
+
}
|
|
13546
|
+
});
|
|
13547
|
+
|
|
13548
|
+
/* ========= 全量 install ========= */
|
|
13549
|
+
|
|
13550
|
+
var _install = function install(Vue) {
|
|
13551
|
+
if (_install.installed) return;
|
|
13552
|
+
_install.installed = true;
|
|
13553
|
+
|
|
13554
|
+
// 注册组件
|
|
13555
|
+
Object.keys(components).forEach(function (key) {
|
|
13556
|
+
Vue.component(key, components[key]);
|
|
13557
|
+
});
|
|
13558
|
+
|
|
13559
|
+
// 注册服务
|
|
13560
|
+
Object.keys(services).forEach(function (key) {
|
|
13561
|
+
Vue.prototype["$".concat(key)] = services[key];
|
|
13495
13562
|
});
|
|
13496
|
-
Vue.prototype.$Message = components_message;
|
|
13497
|
-
Vue.prototype.$Modal = modal;
|
|
13498
|
-
Vue.prototype.$Prompt = components_prompt;
|
|
13499
|
-
Vue.prototype.$Indicator = components_Indicator;
|
|
13500
13563
|
};
|
|
13564
|
+
|
|
13565
|
+
/* ========= 自动安装(script 方式) ========= */
|
|
13566
|
+
|
|
13501
13567
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
13502
|
-
|
|
13568
|
+
_install(window.Vue);
|
|
13503
13569
|
}
|
|
13504
|
-
|
|
13505
|
-
|
|
13570
|
+
|
|
13571
|
+
/* ========= 按需导出 + 默认导出 ========= */
|
|
13572
|
+
|
|
13573
|
+
|
|
13574
|
+
/* harmony default export */ const src = ({
|
|
13575
|
+
install: _install
|
|
13506
13576
|
});
|
|
13507
|
-
/* harmony default export */ const src = (exportObj);
|
|
13508
13577
|
})();
|
|
13509
13578
|
|
|
13510
13579
|
/******/ return __webpack_exports__;
|