@chuzhi_ccd/the-chuzhi-element 1.0.2
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 +96 -0
- package/dist/es/favicon.ico +0 -0
- package/dist/es/v-element.js +2021 -0
- package/dist/index.css +1 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/umd/favicon.ico +0 -0
- package/dist/umd/index.css +1 -0
- package/dist/umd/v-element.umd.cjs +776 -0
- package/dist//350/277/231/351/207/214/346/230/257/347/273/217/350/277/207vite/346/211/223/345/214/205/345/245/275/347/232/204/346/226/207/344/273/266.md +0 -0
- package/package.json +95 -0
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
## 进阶必学!最新 Vue3.3 + TS4 高仿 ElementPlus 打造自己的组件库
|
|
2
|
+
|
|
3
|
+
**v-element** 是为慕课网打造的一套教学组件库,使用最新的 Vue3.3 和 TS, 意在让大家从零到一,由浅入深的提高自己的 Vue 和 typescript 水平,地址: [https://coding.imooc.com/class/693.html](https://coding.imooc.com/class/693.html)
|
|
4
|
+
|
|
5
|
+
### 安装
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm i @vikingmute/v-element --save
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### 开始使用
|
|
13
|
+
|
|
14
|
+
**全局使用**
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
// 引入所有组件
|
|
19
|
+
import VElement from '@vikingmute/v-element'
|
|
20
|
+
// 引入样式
|
|
21
|
+
import '@vikingmute/v-element/dist/style.css'
|
|
22
|
+
|
|
23
|
+
import App from './App.vue'
|
|
24
|
+
// 全局使用
|
|
25
|
+
createApp(App).use(VElement).mount('#app')
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<template>
|
|
30
|
+
<vk-button>我是 VkButton</vk-button>
|
|
31
|
+
</template>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**单个导入**
|
|
35
|
+
|
|
36
|
+
V Element 提供了基于 ES Module 的开箱即用的 Tree Shaking 功能。
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<template>
|
|
41
|
+
<Button>我是 VkButton</Button>
|
|
42
|
+
</template>
|
|
43
|
+
<script>
|
|
44
|
+
import { Button } from ' @vikingmute/v-element'
|
|
45
|
+
export default {
|
|
46
|
+
components: { Button },
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 课程亮点
|
|
52
|
+
|
|
53
|
+
* 亮点1 🔥:“稀有”,目前上市面没有类似的高级课程,由浅入深的高仿 Element-Plus 完成组件库开发的全流程。
|
|
54
|
+
* 亮点2 💧: “专业”,传授大厂前端项目架构设计思想/开发模式/代码规范/流程,不搞小作坊式代码。
|
|
55
|
+
* 亮点3 ⛑️: “全”,精选十几个组件,可以涵盖大部分的主流组件的设计思想以及原理,知识覆盖面全。
|
|
56
|
+
* 亮点4 📚:“新”,使用目前2023年 Vue3 周边最新 ,最全技术:Vue3.2 + Typescript4, Vite,Vitest, Vitepress,Vue-test-utils2,Rollup, Postcss 一网打尽。
|
|
57
|
+
* 亮点5 🎉:“难”,难度逐渐上升,高薪必备敲门砖,包括:Message - Select - Form 这种高难度高复杂组件。
|
|
58
|
+
* 亮点6 🌹:单元测试,被常年忽略但是非常重要的内容,简历加分项,使用最新的 Vitest,Vue-test-utils2 完成单元测试。
|
|
59
|
+
* 亮点7 📚: 文档生成工具,组件库打包和发布以及其他周边流程应有尽有,提供一揽子解决方案。
|
|
60
|
+
* 亮点8 📦: 长期维护以及更新,会根据同学的反馈每年更新几个高频组件。
|
|
61
|
+
|
|
62
|
+
### rollup使用(打包):
|
|
63
|
+
```bash
|
|
64
|
+
npx rollup 要处理的文件 --file (.../)要输出的文件名 --format iife(可选)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 本地测试组件库
|
|
68
|
+
1. 创建软连接(目的是关联v-element目录下的文件,不需要先发布修改后的组件库,再在本地测试项目中使用)
|
|
69
|
+
```bash
|
|
70
|
+
# 在v-element目录下执行
|
|
71
|
+
npm link
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# 在本地测试项目目录下执行
|
|
76
|
+
npm link v-element
|
|
77
|
+
```
|
|
78
|
+
### 发布组件到npm
|
|
79
|
+
1. 登录npm账号
|
|
80
|
+
```bash
|
|
81
|
+
npm login
|
|
82
|
+
```
|
|
83
|
+
2. 发布前调整
|
|
84
|
+
在package.json中的script字段中添加发布命令
|
|
85
|
+
```json
|
|
86
|
+
"scripts": {
|
|
87
|
+
"prepublishOnly": "npm run build"
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
其中pre前缀表示在运行npm publish命令前,先执行npm run build命令
|
|
91
|
+
|
|
92
|
+
3. 发布组件到npm
|
|
93
|
+
在v-element目录下执行以下命令
|
|
94
|
+
```bash
|
|
95
|
+
npm publish --access public
|
|
96
|
+
```
|
|
Binary file
|