v3-comf-dm 1.0.0 → 1.0.1
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 +10 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
# Vue Component Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
一个基于 **Vue3** 的组件库项目。
|
|
4
4
|
|
|
5
5
|
## 特性
|
|
6
6
|
|
|
7
7
|
- ✅ 使用 Vue3 语法开发
|
|
8
|
-
- ✅ 支持打包为 Vue2 和 Vue3 两个版本
|
|
9
8
|
- ✅ 支持 npm 发布(可配置公有/私有源)
|
|
10
9
|
- ✅ 支持代码复制使用(低耦合设计)
|
|
11
10
|
- ✅ 集成 Vitest 测试框架
|
|
12
11
|
- ✅ 自动样式兼容(Autoprefixer)
|
|
13
12
|
- ✅ TypeScript 支持
|
|
14
13
|
- ✅ 完整的类型定义
|
|
14
|
+
- ✅ 内置示例:`examples/vue3-example`
|
|
15
15
|
|
|
16
16
|
## 安装
|
|
17
17
|
|
|
18
18
|
### npm 安装
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
npm install
|
|
21
|
+
npm install v3-comf-dm
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
### 使用
|
|
@@ -28,34 +28,24 @@ npm install @your-org/vue-component-library
|
|
|
28
28
|
```typescript
|
|
29
29
|
import { createApp } from 'vue'
|
|
30
30
|
import App from './App.vue'
|
|
31
|
-
import VueComponentLibrary from '
|
|
32
|
-
import '
|
|
31
|
+
import VueComponentLibrary from 'v3-comf-dm'
|
|
32
|
+
import 'v3-comf-dm/style'
|
|
33
33
|
|
|
34
34
|
const app = createApp(App)
|
|
35
35
|
app.use(VueComponentLibrary)
|
|
36
36
|
app.mount('#app')
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
#### Vue2 项目
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
import Vue from 'vue'
|
|
43
|
-
import VueComponentLibrary from '@your-org/vue-component-library/vue2'
|
|
44
|
-
import '@your-org/vue-component-library/vue2/style'
|
|
45
|
-
|
|
46
|
-
Vue.use(VueComponentLibrary)
|
|
47
|
-
```
|
|
48
|
-
|
|
49
39
|
#### 按需引入
|
|
50
40
|
|
|
51
41
|
```typescript
|
|
52
|
-
import {
|
|
42
|
+
import { ScaleContainer, ImageCropper } from 'v3-comf-dm'
|
|
53
43
|
|
|
54
44
|
// 在组件中使用
|
|
55
45
|
export default {
|
|
56
46
|
components: {
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
ScaleContainer,
|
|
48
|
+
ImageCropper
|
|
59
49
|
}
|
|
60
50
|
}
|
|
61
51
|
```
|
|
@@ -77,14 +67,8 @@ npm run dev
|
|
|
77
67
|
### 构建
|
|
78
68
|
|
|
79
69
|
```bash
|
|
80
|
-
# 构建
|
|
70
|
+
# 构建
|
|
81
71
|
npm run build
|
|
82
|
-
|
|
83
|
-
# 只构建 Vue3 版本
|
|
84
|
-
npm run build:vue3
|
|
85
|
-
|
|
86
|
-
# 只构建 Vue2 版本
|
|
87
|
-
npm run build:vue2
|
|
88
72
|
```
|
|
89
73
|
|
|
90
74
|
### 测试
|
|
@@ -108,15 +92,6 @@ npm run test:coverage
|
|
|
108
92
|
npm run publish:npm
|
|
109
93
|
```
|
|
110
94
|
|
|
111
|
-
### 发布到私有源
|
|
112
|
-
|
|
113
|
-
1. 修改 `.npmrc` 文件,配置私有源地址
|
|
114
|
-
2. 运行:
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
npm run publish:private
|
|
118
|
-
```
|
|
119
|
-
|
|
120
95
|
## 组件开发规范
|
|
121
96
|
|
|
122
97
|
### 1. 组件结构
|
|
@@ -164,8 +139,7 @@ vue-component-library/
|
|
|
164
139
|
│ └── index.ts # 入口文件
|
|
165
140
|
├── examples/ # 示例项目
|
|
166
141
|
├── tests/ # 测试文件
|
|
167
|
-
├── dist/ #
|
|
168
|
-
├── dist-vue2/ # 构建输出(Vue2)
|
|
142
|
+
├── dist/ # 构建输出
|
|
169
143
|
└── vite.config.ts # Vite 配置
|
|
170
144
|
```
|
|
171
145
|
|