feidou-oa 1.0.9

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 ADDED
@@ -0,0 +1,124 @@
1
+ # my-vue-components-lib
2
+
3
+ 这是一个基于 Vue 2 和 Element UI 的组件库,提供了常用的业务组件。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npm install @cpq1108/my-vue-components-lib
9
+ ```
10
+
11
+ ## 使用
12
+
13
+ ### 完整引入
14
+
15
+ ```javascript
16
+ import Vue from 'vue';
17
+ import MyComponentsLib from '@cpq1108/my-vue-components-lib';
18
+ import 'element-ui/lib/theme-chalk/index.css'; // 引入 Element UI 样式
19
+ import 'my-vue-components-lib/dist/style.css'; // 引入组件库样式
20
+
21
+ Vue.use(MyComponentsLib);
22
+ ```
23
+
24
+ ### 按需引入
25
+
26
+ 如果您只需要使用部分组件,可以按需引入:
27
+
28
+ ```javascript
29
+ import { MyComponent } from '@cpq1108/my-vue-components-lib';
30
+ import 'element-ui/lib/theme-chalk/index.css'; // 引入 Element UI 样式
31
+ import 'my-vue-components-lib/dist/style.css'; // 引入组件库样式
32
+
33
+ Vue.component(MyComponent.name, MyComponent);
34
+ ```
35
+
36
+ ## 在 Vue 2 + Webpack 项目中的使用
37
+
38
+ 如果您的项目使用 Vue 2 + Webpack 构建,可能需要额外配置 babel 来确保兼容性:
39
+
40
+ 1. 安装 babel 依赖:
41
+ ```bash
42
+ npm install --save-dev @babel/core @babel/preset-env @babel/plugin-proposal-nullish-coalescing-operator @babel/plugin-proposal-optional-chaining
43
+ ```
44
+
45
+ 2. 配置 babel (babel.config.js):
46
+ ```javascript
47
+ module.exports = {
48
+ presets: [
49
+ [
50
+ '@babel/preset-env',
51
+ {
52
+ targets: {
53
+ browsers: ['> 1%', 'last 2 versions', 'not ie <= 8']
54
+ },
55
+ useBuiltIns: 'usage',
56
+ corejs: 3
57
+ }
58
+ ]
59
+ ],
60
+ plugins: [
61
+ // 转换 nullish-coalescing 操作符 (??)
62
+ '@babel/plugin-proposal-nullish-coalescing-operator',
63
+ // 转换 optional-chaining 操作符 (?.)
64
+ '@babel/plugin-proposal-optional-chaining'
65
+ ]
66
+ };
67
+ ```
68
+
69
+ 3. 在 webpack 配置中确保 babel-loader 处理相关文件。
70
+
71
+ ## 注意事项
72
+
73
+ 由于我们的组件库使用了 Element UI 组件,因此您需要在项目中安装 Element UI:
74
+
75
+ ```bash
76
+ npm install element-ui
77
+ ```
78
+
79
+ 并且需要在项目入口处引入 Element UI 的样式文件。
80
+
81
+ ## 组件列表
82
+
83
+ - MyButton: 按钮组件
84
+ - MyComponent: 示例组件
85
+
86
+ ## 开发
87
+
88
+ ### 本地开发
89
+
90
+ ```bash
91
+ # 启动开发服务器
92
+ npm run dev
93
+
94
+ # 构建组件库
95
+ npm run build-lib
96
+ ```
97
+
98
+ ### 发布组件库
99
+
100
+ ```bash
101
+ # 登录 NPM
102
+ npm login
103
+
104
+ # 更新版本号
105
+ npm version patch
106
+
107
+ # 构建
108
+ npm run build-lib
109
+
110
+ # 发布
111
+ npm publish
112
+ ```
113
+
114
+ ## 技术栈
115
+
116
+ - Vue 2
117
+ - Element UI
118
+ - Vite 作为构建工具
119
+ - JavaScript (ES6+)
120
+ - CSS
121
+
122
+ ## License
123
+
124
+ MIT